user21249663
user21249663

Reputation: 11

org.openqa.selenium.SessionNotCreatedException: Some devices were found, but could not be used. Remote Automation is turned off

I use the MacOS host to automate safari on the real iOS device. It reports the following error:

Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: Could not create a session: Some devices were found, but could not be used:
- iPhone : Remote Automation is turned off (turn it on via Settings > Safari > Advanced > Remote Automation)
Build info: version: '4.0.0-alpha-2', revision: 'f148142cf8', time: '2019-07-01T21:30:18'
System info: host: 'MacBook-Pro.local', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.16', java.version: '1.8.0_271'
Driver info: driver.version: SafariDriver
remote stacktrace: 
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at org.openqa.selenium.remote.W3CHandshakeResponse.lambda$errorHandler$0(W3CHandshakeResponse.java:62)
    at org.openqa.selenium.remote.HandshakeResponse.lambda$getResponseFunction$0(HandshakeResponse.java:30)
    at org.openqa.selenium.remote.ProtocolHandshake.lambda$createSession$1(ProtocolHandshake.java:127)
    at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
    at java.util.Spliterators$ArraySpliterator.tryAdvance(Spliterators.java:958)
    at java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:126)
    at java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:499)
    at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:486)
    at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472)
    at java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:152)
    at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
    at java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:464)
    at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:129)
    at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:75)
    at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:139)
    at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:576)
    at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:210)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:130)
    at org.openqa.selenium.safari.SafariDriver.<init>(SafariDriver.java:81)
    at org.openqa.selenium.safari.SafariDriver.<init>(SafariDriver.java:63)
    at com.chomedriver.IOSSafariTest.getDriver(IOSSafariTest.java:22)
    at com.chomedriver.IOSSafariTest.main(IOSSafariTest.java:45)

But I've turned on remote automation. Here is my program:

public class IOSWebView {
    public static RemoteWebDriver getDriver() {
        SafariOptions safariOptions = new SafariOptions();
        safariOptions.setCapability("platformName", "ios");
        return new SafariDriver(safariOptions);
    }

    public static void main(String[] args) {
        RemoteWebDriver driver = getDriver();
        driver.get("https://www.qq.com");
        System.out.println(driver.getCurrentUrl());
        System.out.println(driver.getTitle());
        driver.quit();
    }
}

My MacOS version is 11.6 and iOS version is 16.3.1. Help me, please~

I have updated safaridriver on my computer, but it still doesn't work.

Upvotes: 1

Views: 146

Answers (0)

Related Questions