I am trying to automate Web app on iOS Safari for e2e test.
Even though following code worked for emulator in iOS 17 beta,
it seems not working on Real Device(iPhone 12, iOS 16.6).
code for test
describe("test0", () => {
const getDriver = async () => {
const options = new safari.Options()
const capabilities = webdriver.Capabilities.safari()
capabilities.setPlatform('ios')
capabilities.set('safari:deviceType', 'iphone')
capabilities.set('safari:useSimulator', false)
const driver = new Builder().forBrowser('safari').withCapabilities(capabilities).setSafariOptions(options).build()
return driver
}
let driver
beforeAll(async () => {
driver = await getDriver()
}, 10000000)
afterAll(async () => {
await driver.quit();
});
test("test", async () => {
await driver.get("https://google.com");
}, 1000000);
});
Following error will happen when testing through real device while device is listed on Device and Simulators
opened by Xcode > Window > Device and Simulators
.
SessionNotCreatedError: Could not create a session: Some devices were found, but could not be used:
- iPhone (***-xxxxxxx): Remote Automation is turned off (turn it on via Settings > Safari > Advanced > Remote Automation)
- [unknown wireless device]: device is not paired
at Object.throwDecodedError (../node_modules/selenium-webdriver/lib/error.js:524:15)
at parseHttpResponse (../node_modules/selenium-webdriver/lib/http.js:601:13)
at Executor.execute (../node_modules/selenium-webdriver/lib/http.js:529:28)
What I tried
I turned on Safari > Advanced > Web Inspector
, Safari > Advanced > Remote Automation
, Developper > Enable UI Automation
on iOS setting.
I enabled safaridriver running safaridriver --enable
.
Versions
XCode: 15.0 beta iOS: 17 beta