hello every one i am facing the same kind of problem , i want to test Browser links on native app , when i clicked on links from native app then broswer is opened but from browser i want to check wehter this link is matched with my expected result below is my code can anyone to figure out the problem
@Test(priority = 10)//Validate that FaceBook Link is working Fine
public void ValidateFacebookLink() throws MalformedURLException, InterruptedException {
WebElement FaceBookLinkID = driver
.findElement(By.id(“com.fittingnzidd.cherripik.development:id/tv_share_biz_fb”));
FaceBookLinkID.click();
// CherryPikLaunchInBrowser();
chromeBrowser();
}
public void chromeBrowser() throws InterruptedException {
Thread.sleep(5000);
Set contextNames = driver.getContextHandles();
for (String contextName : contextNames) {
System.out.println(“WebView:”+contextName);
if (contextName.contains(“WEBVIEW”)){
driver.context(contextName);
System.out.println(“WebView:”+contextName);
String ActualURL=driver.getCurrentUrl();
}