Вы можете использовать один и тот же экземпляр сервера приложений. Не нужно убивать сервер, но вы, вероятно, захотите использовать два разных экземпляра драйвера.
AppiumDriverLocalService service;
IOSDriver iosDriver;
public void setUp() throws IOException {
service = AppiumDriverLocalService.buildDefaultService();
service.start();
}
public void startMyApplication(){
DesiredCapabilities dc = new DesiredCapabilities();
dc.setCapability(MobileCapabilityType.DEVICE_NAME, "iPhone");
dc.setCapability(MobileCapabilityType.UDID, "3838n838fn38jf8n838ffabcdefg");
dc.setCapability(MobileCapabilityType.PLATFORM_NAME, MobilePlatform.IOS);
dc.setCapability(MobileCapabilityType.APP, "com.your_package.name");
iosDriver = new IOSDriver("http://localhost:4723/wd/hub", dc);
}
public void testMyGoogleLoginOnMyApplication(){
//I intend to do something here
//Once i am finished, I close my application
iosDriver.quit();
}
public void startSafari(){
DesiredCapabilities dc = new DesiredCapabilities();
dc.setCapability(MobileCapabilityType.DEVICE_NAME, "iPhone");
dc.setCapability(MobileCapabilityType.UDID, "3838n838fn38jf8n838ffabcdefg");
dc.setCapability(MobileCapabilityType.PLATFORM_NAME, MobilePlatform.IOS);
dc.setCapability(MobileCapabilityType.APP, "com.safari_package.name");
iosDriver = new IOSDriver("http://localhost:4723/wd/hub", dc);
}
public void testSafari(){
//I intend to go to google and do stuff
//Once i am finished, I close my application
iosDriver.quit();
}
public void finished(){
service.stop();
}
Я попробую это. Как получить имя пакета для таких приложений, как сафари, gmail и т. Д.? – manutd
Вот инструмент. https://help.tune.com/marketing-console/finding-ios-app-details/#bundle-lookup –