Hello,
Is there anyway to switch to another app in iOS ,similar to StartActivity() which is present for android driver?
Hello,
Is there anyway to switch to another app in iOS ,similar to StartActivity() which is present for android driver?
Hi Mitesh
did you get any solution for this issue. If I do call driver.closeApp() then the simulator shutdown. Please let me know if you find any solution for this issue.
Thanks
Karthik
No karthik, I didn’t found any solution till yet. Will update you on this if I get any solution for this in future.
Hi Mitesh,
Did you get any solution/alternative for this?
Thanks,
Rohit Gupta
Hello Rohit,
I did explore for the alternatives but was not able to find any solution apart from the solution suggested in the thread above.
Found a solution
We have to set noReset field value as true in Desired Capability. This will not
allow the simulator to close when we call driver quit. So all the settings will
remain same for our next new driver.
Note: It can not be used for parallel access of two apps, but serial
Oh so sorry karthik I thought I have mentioned this solution earlier because we have already implemented same solution for our project.
Hey i tried what you recommended. But i get error
rg.openqa.selenium.SessionNotCreatedException: Unable to create new remote session. desired capabilities = Capabilities [{app=com.apple.Preferences, noReset=true, platformVersion=10.3, platformName=iOS, deviceName=iPhone6}], required capabilities = Capabilities [{}]
Build info: version: ‘3.3.1’, revision: ‘5234b325d5’, time: ‘2017-03-10 09:10:29 +0000’
sample code :
driver.findElement(By.name(“Done”)).click();
System.out.println(driver.switchTo().alert().getText());
driver.switchTo().alert().accept();
driver.quit();
IOSDriver d;
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("platformName", config.get("name"));
capabilities.setCapability("platformVersion", config.get("version"));
capabilities.setCapability("deviceName", "iPhone6");
capabilities.setCapability("noReset", "true");
capabilities.setCapability("app", "com.apple.Preferences");
d = new IOSDriver(new URL("http://0.0.0.0:4723/wd/hub"), capabilities);
d.manage().timeouts().implicitlyWait(90, TimeUnit.SECONDS);
driver.launchApp();