Reputation: 75
I need to test websites using selenium webdriver on java. My goal is to make and save changes on one website and then see if the other website changed content accordingly. I want to make a change, then switch to a different window with a different website, then back and forth multiple times. Is it possible? Thank you!
Upvotes: 1
Views: 1547
Reputation: 2444
Yes, it is possible!
And you can actually do it by switching between various windows.
Here you can find a great guide about the switch commands: http://toolsqa.com/selenium-webdriver/switch-commands/
For example:
String winHandleBefore = driver.getWindowHandle(); //save the current window handle
for(String winHandle : driver.getWindowHandles()){
driver.switchTo().window(winHandle);
} //switch window
driver.close(); //close the new window
driver.switchTo().window(winHandleBefore); //switch again to the first window
Hope it helps!
Upvotes: 1