Hi,
I currently have encountered a problem with a UI test automation flow. In the flow I need to navigate to a second pop-up window and fill some data on that pop-up screen. After filling the data on the pop-up window it will automatically close after clicking a button. After that I need to switch back to the parent window. Switching to to the pop-up window is causing no problems, but switching to the parent window won't function and makes CA DevTest endlessly trying to load the step switching back to the parent window. Also the window names/titles are uniquely generated each time the test will be run. Can someone help me with this problem?
The scripts in the steps that I use now for switching windows are:
// step 1: storing the parent window name in property
import org.openqa.selenium.remote.RemoteWebDriver;
import org.openqa.selenium.JavascriptExecutor;
RemoteWebDriver driver = testExec.getStateObject("selenium.testrun").testRun.getDriver();
String winHandleBefore = driver.getWindowHandle();
testExec.setStateValue("ParentWindow",winHandleBefore);
//step 2: switching to pop-up window
import org.openqa.selenium.remote.RemoteWebDriver;
import org.openqa.selenium.JavascriptExecutor;
RemoteWebDriver driver = testExec.getStateObject("selenium.testrun").testRun.getDriver();
String winHandleBefore = driver.getWindowHandle();
for(String winHandle : driver.getWindowHandles()){
driver.switchTo().window(winHandle);}
// step 3: JSON step that switches back to the parent window with the name stored in the property
[{"type":"switchToWindow","name":"{{ParentWindow}}"}]