So I'm testing a web app for which I have to open a new tab, switch to it, do some input, than switch back to the first tab and this more than once. I try to open the new tab this way:
((JavascriptExecutor) AppiumTestBase.getDriver()).executeScript("window.open('http://google.com', '_blank')");
This causes the following alert to appear:
But I'm not able to accept it through automation with Appium. Things that I have tried:
- Using the following capabilities: "safariAllowPopups" and "autoAcceptAlerts"
- Changing the according settings for safari in the iOS sim
- .switchTo().alert().accept(); I also waited for the Popup.
- Switchting to native context before accepting the popup
- Clicking the pop up by name .findElement(By.name("Allow")).click();
What I have not tried:
- Taping on the screen according to the pop-up coordinates. I didn't try this since I'm not sure on how to get the position of the "Allow" button.
And my other question is how would I switch between two tabs? I haven't tried anything yet, but research would suggest that I try it with window contexts.
Some other information:
- Currently testing with a iPhoneSE iOS 9.3 Simulator, the solution should work for several configurations
- Appium is on the most recent version
- The class "AppiumTestBase"s only purpose is to set capabilities and initialize the AppiumDriver