I can get the all the opened tab titles by switching to each tab. Like below,
Code:
ArrayList<String> tabs = new ArrayList<String>(driver.getWindowHandles());
for(int i = 0; i < tabs.size(); i++) {
driver.switchTo().window(tabs.get(i));
System.out.println(driver.getTitle());
}
Output:
Google
Home
Is there any way to get all the titles without switching? Something like below,
for(String tab : tabs){
System.out.println(tab)
}
but the above code is returning the tab id's.
CDwindow-54AD3D4D73FFC6A60F79C1E56B131C2B
CDwindow-046B8E378703FEAAD1002BF3F835BAB7