Looking at your code, I think this line is not needed:

ArrayList<String> windowTab = new ArrayList<String>(driver.getWindowHandles());

If you want to switch tabs use code like the example below:

String currentscreen = driver.getWindowHandle(); //for identifying the current 
Set<String> tabSet = driver.getWindowHandles(); //to get total 
for (String tab : tabSet) {
    if (!tab.equals(currentscreen)) {
       driver.switchTo().(tab);
       //and do the actions you need here  
       String url = driver.getCurrentUrl();
       System.out.println(url);
     }
}

It prints the URL only one time if you have only one different tab compared to the current tab.



Source link https://sqa.stackexchange.com/questions/14714/i-am--a--which-will--up-a--while--on-a--after

LEAVE A REPLY

Please enter your comment!
Please enter your name here