selenium icon indicating copy to clipboard operation
selenium copied to clipboard

Cannot run browser with WebDriver 3.0.0, Safari 10 and ElCaptain 10.11.6

Open aolkuski opened this issue 10 years ago • 19 comments

OS:

Mac OS El Captain 10.11.6

Selenium Version:

3.0.0,

Driver:

SafariDriver 2.48

Browser:

Safari 10

Browser Version:

11602.1.50.0.10

Expected Behavior -

When starting driver, browser is starting and performing commands

Actual Behavior -

Browser is starting, but nothing happens or browser is not starting at all - depending on previous commands: if process listed by this command (launchctl list | grep webdriverd) is running, browser is not starting at all. If I kill the process, browser is starting, but nothing happens

Steps to reproduce -

Write a test working with Se3.0.0 and Chrome or Se2.53.1 and any browser, change settings and try to run in on Safari using Se3.0.0.

Capabilities:

    SafariOptions safariOpts = new SafariOptions();
    DesiredCapabilities cap = DesiredCapabilities.safari();

    safariOpts.setUseCleanSession(true);
    cap.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
    cap.setCapability(CapabilityType.UNEXPECTED_ALERT_BEHAVIOUR, "dismiss");
    cap.setCapability(SafariOptions.CAPABILITY, safariOpts);
    cap.setBrowserName("safari");
    cap.setPlatform(Platform.MAC);

AND - I guess - the most helpful information here - whole setup and tests are working with previous version of webdriver (2.53.1) and SafariDriver 2.48

Stacktrace

    Unable to start the server: another safaridriver is already running (@ localhost:28142).
    paź 19, 2016 5:06:53 PM org.openqa.selenium.remote.ProtocolHandshake createSession
    INFO: Attempting bi-dialect session, assuming Postel's Law holds true on the remote end
    Unable to start the server: another safaridriver is already running (@ localhost:28142).
    paź 19, 2016 5:07:15 PM org.openqa.selenium.remote.ProtocolHandshake createSession
    INFO: Attempting bi-dialect session, assuming Postel's Law holds true on the remote end

    org.openqa.selenium.WebDriverException: The driver server has unexpectedly died!
    Build info: version: '3.0.0', revision: '350cf60', time: '2016-10-13 10:48:57 -0700'
    System info: host: 'krk-mptye', ip: '***.***.***.***', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.11.6', java.version: '1.8.0_92'
    Driver info: driver.version: SafariDriver

at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:88)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:601)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:241)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:128)
at org.openqa.selenium.safari.SafariDriver.<init>(SafariDriver.java:62)
at org.openqa.selenium.safari.SafariDriver.<init>(SafariDriver.java:53)
at core.engineui.WebDriverAdapter.getDriver(WebDriverAdapter.java:55)
at core.engineui.webdriver.SnapshotProvider.takeAScreenshot(SnapshotProvider.java:45)
at core.engineui.webdriver.SnapshotProvider.takeSnapshots(SnapshotProvider.java:36)
at core.listeners.UiTestSubListener.takeASnapshot(UiTestSubListener.java:51)
at core.listeners.UiTestSubListener.takeASnapshot(UiTestSubListener.java:55)
at core.listeners.UiTestSubListener.additionalTearDown(UiTestSubListener.java:40)
at core.listeners.TestRunListener.afterInvocation(TestRunListener.java:50)
at org.testng.internal.invokers.InvokedMethodListenerInvoker$InvokeAfterInvocationWithoutContextStrategy.callMethod(InvokedMethodListenerInvoker.java:100)
at org.testng.internal.invokers.InvokedMethodListenerInvoker.invokeListener(InvokedMethodListenerInvoker.java:62)
at org.testng.internal.Invoker.runInvokedMethodListeners(Invoker.java:556)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:699)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:820)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1128)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:129)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:112)
at org.testng.TestRunner.privateRun(TestRunner.java:782)
at org.testng.TestRunner.run(TestRunner.java:632)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:366)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:361)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:319)
at org.testng.SuiteRunner.run(SuiteRunner.java:268)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1244)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1169)
at org.testng.TestNG.run(TestNG.java:1064)
at org.testng.IDEARemoteTestNG.run(IDEARemoteTestNG.java:74)
at org.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:124)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)
    Caused by: org.apache.http.conn.HttpHostConnectException: Connect to localhost:5252 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused
at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:158)
at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:353)
at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:380)
at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:236)
at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:184)
at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:88)
at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)
at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:71)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:55)
at org.openqa.selenium.remote.internal.ApacheHttpClient.fallBackExecute(ApacheHttpClient.java:142)
at org.openqa.selenium.remote.internal.ApacheHttpClient.execute(ApacheHttpClient.java:88)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:108)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:64)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:141)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:82)
... 38 more
    Caused by: java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at org.apache.http.conn.socket.PlainConnectionSocketFactory.connectSocket(PlainConnectionSocketFactory.java:74)
at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:141)
... 53 more

aolkuski avatar Oct 19 '16 15:10 aolkuski

"Unable to start the server: another safaridriver is already running"

You are only allowed to run one instance of safaridriver at a time.

lukeis avatar Oct 20 '16 15:10 lukeis

@lukeis http://alunthomasevans.blogspot.com/2007/10/old-microsoft-joke.html

@aolkuski, try: > launchctl list | grep webdriverd > sudo kill xxxx where xxxx is the process id of the webdriverd process. Which it looks like you may already have tried (now that I re-read your original post)...

You might also try enabling the 'Allow Remote Automation' option from the Develop menu in Safari if it isn't already checked.

ashusta avatar Nov 02 '16 21:11 ashusta

@ashusta heh :) also... that's what the selenium-users google group is for, and I may be a bit jaded from triaging bug reports here for so long :)

lukeis avatar Nov 02 '16 21:11 lukeis

The thing is - I'm killing all engines manually before I start running tests. It still does not work...

aolkuski avatar Nov 07 '16 10:11 aolkuski

Hi,

I am facing the same issue.

The behavior is: "Browser is starting, but nothing happens or browser is not starting at all - depending on previous commands: if process listed by this command (launchctl list | grep webdriverd) is running, browser is not starting at all. If I kill the process, browser is starting, but nothing happens"

Is there a fix for this issue? As I see the issue has been closed.

priyavishnu avatar Nov 16 '16 19:11 priyavishnu

Hi,

Just would like to add a counting in this issue that priyavishnu mention above.

And I get the error message if before create WebDirver I add command: options.setUseTechnologyPreview(true);

The error: org.openqa.selenium.SessionNotCreatedException: Unable to create new remote session. desired capabilities = Capabilities [{browserName=safari, safari.options=org.openqa.selenium.safari.SafariOptions@10e3f, version=, platform=MAC}], required capabilities = Capabilities [{}] Build info: version: '3.0.1', revision: '1969d75', time: '2016-10-18 09:49:13 -0700' System info: host: 'Thanhs-MacBook-Pro.local', ip: 'x.x.x.x', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.12.3', java.version: '1.8.0_60'

Thanks Driver info: driver.version: RemoteWebDriver

thanhltx avatar Feb 05 '17 23:02 thanhltx

Selenium 3.x uses Apple's safaridriver, not the old safaridriver extension. Apple's safaridriver comes with Safari 10, so you have to have Safari 10 to test Safari in Selenium 3.x. If you want to use the latest safaridriver you can use the safaridriver that comes with Safari Technology Preview, but that only works on Sierra, not El Capitan. Finally, the safaridriver that is included in the latest Safari Technology Preview (Release 22) is not working, so you'll need to wait for the next release in order to use it.

titusfortner avatar Feb 06 '17 18:02 titusfortner

@titusfortner Thanks for detailed information. Compatibility seems to be the problem in my case. I'll just have to wait for Sierra update on my company's laptops... Thanks again!

aolkuski avatar Feb 06 '17 18:02 aolkuski

Just Go to Safari>developpement>Autoriser l'automatisation a distance

farouk60 avatar Feb 08 '17 15:02 farouk60

Hi @farouk60,

Thanks for your comments, Could you please give more detail, that where is that navigation.

I've already update the Sierra, and the latest version of Safari(10.0.3). And I also turned on Allow Remote Automation (under Develop menu). When I execute automation selenium can open the browser but there is nothing after that, it is not run next command, and there is not error coming up. The address textbox is marked in orange color, so it's meant the safaridriver is running, and another roof is I see an process id when I run launchctl list | grep webdriverd.

Thanks

thanhltx avatar Feb 08 '17 22:02 thanhltx

You are no longer doing options.setUseTechnologyPreview(true); correct?

titusfortner avatar Feb 08 '17 22:02 titusfortner

Hi @titusfortner,

No, I am not, I get same issue when I remove that command, or had options.setUseTechnologyPreview(false);

Many thanks for help

thanhltx avatar Feb 08 '17 23:02 thanhltx

Not sure what to say. My safari tests are working in Ruby. :)

If you clone the repo (pro tip use --depth 1) and run ./go //rb:safari-test everything should work correctly

titusfortner avatar Feb 08 '17 23:02 titusfortner

thanks for reply, @titusfortner. Are you running with local mode or Remote mode ?

thanhltx avatar Feb 08 '17 23:02 thanhltx

@thanhltx - both work for me.

titusfortner avatar Feb 13 '17 17:02 titusfortner

so i can do test script for you

2017-02-13 12:59 GMT-05:00 Titus [email protected]:

@thanhltx https://github.com/thanhltx - both work for me.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/SeleniumHQ/selenium/issues/2967#issuecomment-279470446, or mute the thread https://github.com/notifications/unsubscribe-auth/AVCqftGon0hf6a9MPRtg9btBw5uxtSmRks5rcJoLgaJpZM4KbFPu .

--

Farouk RAHEM Consultant IT – Spécialiste QA

[email protected] [email protected]

C: 514-449-6072

T: 514-312-1399, 315

techso.ca | Suivez-nous sur LinkedIn https://www.linkedin.com/company/techso-solutions et Facebook https://www.facebook.com/techsosolutions

farouk60 avatar Feb 13 '17 18:02 farouk60

I ran

launchctl list | grep webdriverd sudo kill xxxx and the process isn't running but still can't get the browser to spin up. Selenium 3.0.1 Safari 10.0.1 I have the allow remote automation checked I get the error

RuntimeError: Connection refused

when the code hit the init()

mroien avatar Mar 01 '17 23:03 mroien

hi @farouk60

the script is:

` SafariOptions options = new SafariOptions(); options.setUseCleanSession(true); capabilities = DesiredCapabilities.safari(); capabilities.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true); capabilities.setCapability(CapabilityType.UNEXPECTED_ALERT_BEHAVIOUR, "dismiss"); capabilities.setCapability(SafariOptions.CAPABILITY, options); CapabilitiesValue(capabilities);

uri = "http://" + _seleniumServer.nodeIP + ":" + _seleniumServer.nodePort + "/wd/hub"; driver = new RemoteWebDriver(new URL(uri), capabilities); ((RemoteWebDriver)driver).setFileDetector(new LocalFileDetector()); driver.manage().deleteAllCookies(); driver.manage().window().setSize(new Dimension(currentProfile.commonResolutions.get(0).width, currentProfile.commonResolutions.get(0).height)); `

thanks for help

thanhltx avatar Mar 02 '17 02:03 thanhltx

hey guys, I get error:

Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: Could not create a session: The session timed out while connecting to a Safari instance. (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 30.05 seconds Build info: version: '3.8.1', revision: '6e95a6684b', time: '2017-12-01T19:05:32.194Z' System info: host: 'Prashants-MacBook-Pro.local', ip: 'fe80:0:0:0:14c4:c89a:3b1f:8c2b%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.12.3', java.version: '9.0.1' Driver info: driver.version: SafariDriver

my code is 👍 package co.omegapoint.selenium.basic;

//import java.util.concurrent.TimeUnit;

import org.openqa.selenium.WebDriver; import org.openqa.selenium.safari.SafariDriver;

public class Day1 {

	public static void main(String[] args) {

// WebDriver driver = null;

		WebDriver driver = new SafariDriver();

// driver.manage().deleteAllCookies(); // driver.manage().window().maximize(); // driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS); // driver.manage().timeouts().pageLoadTimeout(60, TimeUnit.SECONDS); driver.get("https://www.google.se"); driver.quit();

// Day1 myObj= new Day1(); // myObj.invokeBrowser();

}

}

can aye help me out here, thanks

Mundepi28 avatar Jan 16 '18 14:01 Mundepi28