SeleniumHQ / selenium-google-code-issue-archive

Archive, please see main selenium repo
https://github.com/seleniumhq/selenium
345 stars 195 forks source link

[SafariDriver] Failed to open the application URL #7133

Open lukeis opened 8 years ago

lukeis commented 8 years ago

Originally reported on Google Code with ID 7133

I tried to run selenium test in safari browser. I am facing an exception and not able
to launch the application. The weird point is every time i am getting different exception.

Code Snippet:
-------------

WebDriver driver = new SafariDriver();
driver.get("Application URL");

Expected: Need to open the given application URL.
Actual:

1. Exception: 

org.openqa.selenium.remote.UnreachableBrowserException: Failed to connect to SafariDriver
after 45084 ms
Build info: version: '2.39.0', revision: 'ff23eac', time: '2013-12-16 16:11:15'
System info: host: 'QA02', ip: '192.168.18.58', os.name: 'Windows 7', os.arch: 'amd64',
os.version: '6.1', java.version: '1.7.0_21'
Driver info: driver.version: SafariDriver
    at org.openqa.selenium.safari.SafariDriverCommandExecutor.start(SafariDriverCommandExecutor.java:122)
    at org.openqa.selenium.safari.SafariDriver.startClient(SafariDriver.java:77)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:110)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:115)
    at org.openqa.selenium.safari.SafariDriver.<init>(SafariDriver.java:63)
    at org.openqa.selenium.safari.SafariDriver.<init>(SafariDriver.java:47)
    at com.epro.masterscripts.BrowserLaunch.browser(BrowserLaunch.java:129)
    at com.epro.bootfile.BootUpTest.beforeBoot(BootUpTest.java:103)
    at com.epro.bootfile.BootUpTest.main(BootUpTest.java:473)

2. Exception:

org.openqa.selenium.WebDriverException: Session is executing: findElement; cannot set
current to: newSession (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 63 milliseconds
Build info: version: '2.39.0', revision: 'ff23eac', time: '2013-12-16 16:11:15'
System info: host: 'QA02', ip: '192.168.18.58', os.name: 'Windows 7', os.arch: 'amd64',
os.version: '6.1', java.version: '1.7.0_21'
Driver info: org.openqa.selenium.safari.SafariDriver
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
    at java.lang.reflect.Constructor.newInstance(Unknown Source)
    at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:193)
    at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:145)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:554)
    at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:216)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:111)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:115)
    at org.openqa.selenium.safari.SafariDriver.<init>(SafariDriver.java:63)
    at org.openqa.selenium.safari.SafariDriver.<init>(SafariDriver.java:47)
    at com.epro.masterscripts.BrowserLaunch.browser(BrowserLaunch.java:129)
    at com.epro.bootfile.BootUpTest.beforeBoot(BootUpTest.java:103)
    at com.epro.bootfile.BootUpTest.main(BootUpTest.java:473)

What steps will reproduce the problem?
1. By executing the above code snippet 
2. a.Launch the safari browser by executing the above code snippet
   b.Terminate the program manually
   c.Run again the same code snippet
   d. Above expected result can be achieved

Selenium version: 2.40.0
OS: Windows 7 (64 bit)
Browser: Safari
Browser version: 5.1.7

Please refer the attached screen shot.
But some times test script launched the browser and test script becomes passed.

Reported by manigandanspec on 2014-03-27 11:06:41


lukeis commented 8 years ago

Reported by barancev on 2014-04-08 13:48:13

lukeis commented 8 years ago
Hi,

I am also facing similar kind of issue can any one please help me

Aug 13, 2014 1:07:42 PM org.openqa.selenium.safari.SafariDriverServer start

INFO: Server started on port 27853

Aug 13, 2014 1:07:42 PM org.openqa.selenium.safari.SafariDriverCommandExecutor start

INFO: Launching Safari

Aug 13, 2014 1:07:42 PM org.openqa.selenium.safari.SafariDriverCommandExecutor start

INFO: Waiting for SafariDriver to connect

Aug 13, 2014 1:08:27 PM org.openqa.selenium.safari.SafariDriverCommandExecutor stop

INFO: Shutting down

Aug 13, 2014 1:08:27 PM org.openqa.selenium.safari.SafariDriverCommandExecutor stop

INFO: Stopping Safari

Aug 13, 2014 1:08:27 PM org.openqa.selenium.safari.SafariDriverCommandExecutor stop

INFO: Stopping server

Aug 13, 2014 1:08:27 PM org.openqa.selenium.safari.SafariDriverServer stop

INFO: Stopping server

Aug 13, 2014 1:08:27 PM org.openqa.selenium.safari.SafariDriverCommandExecutor stop

INFO: Uninstalling extensions

Aug 13, 2014 1:08:27 PM org.openqa.selenium.safari.SafariDriverCommandExecutor stop

INFO: Shutdown complete

Aug 13, 2014 1:08:27 PM org.openqa.selenium.safari.SafariDriverCommandExecutor stop

INFO: Shutting down

Aug 13, 2014 1:08:27 PM org.openqa.selenium.safari.SafariDriverCommandExecutor stop

INFO: Stopping server

Aug 13, 2014 1:08:27 PM org.openqa.selenium.safari.SafariDriverCommandExecutor stop

INFO: Uninstalling extensions

Aug 13, 2014 1:08:27 PM org.openqa.selenium.safari.SafariDriverCommandExecutor stop

INFO: Shutdown complete

Exception in thread "main" org.openqa.selenium.remote.UnreachableBrowserException:
Failed to connect to SafariDriver after 45064 ms

Build info: version: '2.42.2', revision: '6a6995d', time: '2014-06-03 17:42:30'

System info: host: 'ini', ip: '43.88.105.241', os.name: 'Mac OS X', os.arch: 'x86_64',
os.version: '10.8.5', java.version: '1.6.0_65'

Driver info: driver.version: SafariDriver

at org.openqa.selenium.safari.SafariDriverCommandExecutor.start(SafariDriverCommandExecutor.java:122)

at org.openqa.selenium.safari.SafariDriver.startClient(SafariDriver.java:72)

at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:114)

at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:139)

at org.openqa.selenium.safari.SafariDriver.<init>(SafariDriver.java:58)

at org.openqa.selenium.safari.SafariDriver.<init>(SafariDriver.java:42)

at sample.test.main(test.java:10)

Reported by divakar.p2 on 2014-08-13 07:53:49

lukeis commented 8 years ago
I also see same problem in my Macbook Pro 10.9.4 with Safari 7.0.5, I am using selenium
standalone jar version 2.43 ..

Reported by way2ashoo on 2014-09-29 06:56:03

lukeis commented 8 years ago
Same problem here, Macbook Pro 10.9.5 with Safari 7.1, I am using Selenium version 2.43.1.

Reported by spyderweiss on 2014-10-03 02:15:46

lukeis commented 8 years ago
I am facing same issue with Safari 6 on Mtn Lion and Safari 7 on Mavericks , any solution
to this problem .

following is the code I have used to set capabilities , I have tried alsmost everything
, please don't suggest something unless it's working for you -

    public RemoteWebDriver goStartDriver(String browserName, String OSName,
            String nodeIP, String nodePort) throws Exception {
        if (browserName.equals("firefox") && OSName.equals("MAC")) {
            cap = DesiredCapabilities.firefox();
            cap.setBrowserName("firefox");
            cap.setPlatform(Platform.MAC);
        } else if (browserName.equals("chrome") && OSName.equals("MAC")) {
            cap = DesiredCapabilities.chrome();
            cap.setBrowserName("chrome");
            cap.setPlatform(Platform.MAC);
        } else if (browserName.equals("chrome") && OSName.endsWith("WINDOWS")) {
            cap = DesiredCapabilities.chrome();
            cap.setBrowserName("chrome");
            cap.setPlatform(Platform.WINDOWS);
        } else if (browserName.equals("iexplore")) {
            cap = DesiredCapabilities.internetExplorer();
            cap.setBrowserName("iexplore");
            cap.setPlatform(Platform.WINDOWS);
        } else if (browserName.equals("firefox") && OSName.equals("WINDOWS")) {
            cap = DesiredCapabilities.chrome();
            cap.setBrowserName("firefox");
            cap.setPlatform(Platform.WINDOWS);
        } else if (browserName.equals("safari")) {
            cap = DesiredCapabilities.safari();
            cap.setBrowserName("safari");
            cap.setPlatform(Platform.MAC);
        }

        if (browserName.equals("firefox") && OSName.equals("WIN8")) {
            cap = DesiredCapabilities.firefox();
            cap.setBrowserName("firefox");
            cap.setPlatform(Platform.WIN8);
        } else if (browserName.equals("chrome") && OSName.equals("WIN8")) {
            cap = DesiredCapabilities.firefox();
            cap.setBrowserName("chrome");
            cap.setPlatform(Platform.WIN8);
        } else if (browserName.equals("iexplore") && OSName.equals("WIN8")) {
            cap = DesiredCapabilities.firefox();
            cap.setBrowserName("iexplore");
            cap.setPlatform(Platform.WIN8);
        }

        float node_port = Float.parseFloat(nodePort);
        int nodePort_ = (int) (node_port);
        driver = new RemoteWebDriver(new URL("http://" + nodeIP + ":"
                + nodePort_ + "/wd/hub"), cap);
        return driver;
    }

Reported by shekhar.nik on 2014-10-10 22:21:51

lukeis commented 8 years ago
I'm seeing the same issue
Exception in thread "main" org.openqa.selenium.remote.UnreachableBrowserException:
Failed to connect to SafariDriver after 10069 ms
Build info: version: '2.43.1', revision: '5163bce', time: '2014-09-10 16:27:58'
System info: host: 'MacBook-Pro', ip: 'xx.xx.xx.xx', os.name: 'Mac OS X', os.arch:
'x86_64', os.version: '10.10', java.version: '1.7.0_65'

Reported by sholland2882 on 2014-10-21 17:31:34

lukeis commented 8 years ago
I am having the same issue.
 I am running a jenkins test that uses the Imac as a slave to run a webdriver test.

My tests do run as designed from the this machine when I launch them from eclipse.

 This was working but now after updating to OS X Yosemite and Safari 8.0 I am receiving
the same error. 

I also receive the following error message on the Safari Browser: Unable to establish
a connection with the Safari Driver extension. 

There is also a popup window that states: A keychain cannot be found to store "Safari."

On my local Safari, I have the Webdriver 2.38.0 extenstion loaded and enabled. 

On the launched Safari that errors out, when I navigate to the extension, it is loaded
but NOT enabled. 

Here is a copy of my stack trace. Kind of surprised not to see a single comment on
here with so many people having the issue. 

The only difference is that this is on the admin account and the jenkins test is on
a jenkins account. 

Here is my stack trace:

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running SeleniumSmokeTestCookbook.tommyBahama.test.SmokeTest
Oct 29, 2014 1:40:16 PM org.openqa.selenium.safari.SafariDriverServer start
INFO: Server started on port 42617
Oct 29, 2014 1:40:16 PM org.openqa.selenium.safari.SafariDriverCommandExecutor start
INFO: Launching Safari
Oct 29, 2014 1:40:16 PM org.openqa.selenium.safari.SafariDriverCommandExecutor start
INFO: Waiting for SafariDriver to connect
Oct 29, 2014 1:40:26 PM org.openqa.selenium.safari.SafariDriverCommandExecutor stop
INFO: Shutting down
Oct 29, 2014 1:40:26 PM org.openqa.selenium.safari.SafariDriverCommandExecutor stop
INFO: Stopping Safari
Oct 29, 2014 1:40:26 PM org.openqa.selenium.safari.SafariDriverCommandExecutor stop
INFO: Stopping server
Oct 29, 2014 1:40:26 PM org.openqa.selenium.safari.SafariDriverServer stop
INFO: Stopping server
Oct 29, 2014 1:40:26 PM org.openqa.selenium.safari.SafariDriverCommandExecutor stop
INFO: Uninstalling extensions
Oct 29, 2014 1:40:26 PM org.openqa.selenium.safari.SafariDriverCommandExecutor stop
INFO: Shutdown complete
Oct 29, 2014 1:40:26 PM org.openqa.selenium.safari.SafariDriverCommandExecutor stop
INFO: Shutting down
Oct 29, 2014 1:40:26 PM org.openqa.selenium.safari.SafariDriverCommandExecutor stop
INFO: Stopping server
Oct 29, 2014 1:40:26 PM org.openqa.selenium.safari.SafariDriverCommandExecutor stop
INFO: Uninstalling extensions
Oct 29, 2014 1:40:26 PM org.openqa.selenium.safari.SafariDriverCommandExecutor stop
INFO: Shutdown complete
Tests run: 2, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 10.455 sec <<< FAILURE!
SmokeOutletTest(SeleniumSmokeTestCookbook.tommyBahama.test.SmokeTest)  Time elapsed:
10.403 sec  <<< ERROR!
org.openqa.selenium.remote.UnreachableBrowserException: Failed to connect to SafariDriver
after 10067 ms
Build info: version: '2.43.1', revision: '5163bceef1bc36d43f3dc0b83c88998168a363a0',
time: '2014-09-10 09:43:55'
System info: host: 'greybook', ip: '10.0.105.83', os.name: 'Mac OS X', os.arch: 'x86_64',
os.version: '10.10', java.version: '1.6.0_65'
Driver info: driver.version: SafariDriver
    at org.openqa.selenium.safari.SafariDriverCommandExecutor.start(SafariDriverCommandExecutor.java:122)
    at org.openqa.selenium.safari.SafariDriver.startClient(SafariDriver.java:72)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:114)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:139)
    at org.openqa.selenium.safari.SafariDriver.<init>(SafariDriver.java:58)
    at org.openqa.selenium.safari.SafariDriver.<init>(SafariDriver.java:51)
    at SeleniumSmokeTestCookbook.tommyBahama.test.SmokeTest.openBrowser(SmokeTest.java:160)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)
    at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
    at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252)
    at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141)
    at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
    at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
    at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
    at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
    at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)

Reported by jackcwestis on 2014-10-29 20:52:51

lukeis commented 8 years ago
Safari:7.1
MAC OS:10.9.5

I am also seeing the same issue. Below is the stack trace I am seeing:

org.openqa.selenium.remote.UnreachableBrowserException: Failed to connect to SafariDriver
after 10079 ms

Build info: version: 'unknown', revision: 'unknown', time: 'unknown'

System info: host: 'xxxxxx', ip: 'xx.xx.x.xx', os.name: 'Mac OS X', os.arch: 'x86_64',
os.version: '10.9.5', java.version: '1.8.0_25'

Driver info: driver.version: SafariDriver

at org.openqa.selenium.safari.SafariDriverCommandExecutor.start(SafariDriverCommandExecutor.java:122)

at org.openqa.selenium.safari.SafariDriver.startClient(SafariDriver.java:72)

at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:114)

at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:139)

at org.openqa.selenium.safari.SafariDriver.<init>(SafariDriver.java:58)

at com.magic.staf.main.Keywords.OpenBrowser(Keywords.java:464)

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:483)

at com.magic.staf.main.KeywordProcessor.executeKeyword(KeywordProcessor.java:731)

at com.magic.staf.main.KeywordProcessor.getKeyword(KeywordProcessor.java:689)

at com.magic.staf.main.KeywordProcessor.executeKeywords(KeywordProcessor.java:158)

at com.magic.staf.main.SuiteReader.startExecution(SuiteReader.java:218)

at com.magic.staf.main.DriverScript.main(DriverScript.java:61)

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:483)

at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58)

Reported by amit.khasa@magicsw.com on 2014-10-30 12:07:02

lukeis commented 8 years ago
In response to comment #8.
There is also a popup window that states: A keychain cannot be found to store "Safari."
When this happens the scripts hang.

On my local Safari, I have the Webdriver 2.38.0 extenstion loaded and enabled.
I am running the scripts via a test automation server (STAF) so the tests are triggered
in the root context, but the driver is launched as the machines local user.

I have tried all solutions for this popup.
Please help resolve this.

I am using selenium-server-standalone-2.44.0.jar and have taken the webdriver out of
this.

Reported by mithran77 on 2014-11-04 11:15:55

lukeis commented 8 years ago
Could at least someone respond to this thread so we at least know someone is looking
into the issue? Or is this just crazy talk....

Reported by jackcwestis on 2014-11-04 15:59:05

lukeis commented 8 years ago
To update comment #8. I could not find a solution for this so I down graded my OS X
to Maverick 10.9. Now the Test actually runs for a period of time before the popup
with the same error message is displayed. Another difference is that if I click cancel
the test continues. I have tried to use the Keychain first aid but this does nothing.

Reported by jackcwestis on 2014-11-04 16:42:09

lukeis commented 8 years ago
To update comment #12. Observed the same with an older version of mavericks/safari.
More moving to ml to see if it goes away entirely :)

Reported by mithran77 on 2014-11-04 16:46:48

lukeis commented 8 years ago
As an update to #13 this is also happening on ML 10.8.5 Safari 6.1.6.
Is there any version of OSx Safari where there is no popup for "A keychain cannot be
found to store Safari."?

If anyone can answer this that would be great!

Reported by mithran77 on 2014-11-04 17:29:46

lukeis commented 8 years ago
I had this working in mountain lion before I upgraded to Yosemite. I do not remember
what version OS X I was working on and I did not use time machine. I do know that the
test currently works on Mac OS X 10.6.8. 

Reported by jackcwestis on 2014-11-11 21:31:40

lukeis commented 8 years ago
I was facing the similar issue: createDriver
org.openqa.selenium.remote.UnreachableBrowserException: Failed to connect to SafariDriver
after 10342 ms

To get it resolved after trying some things, I registered myself at the Apple Site
for “Safari Developer Program” and generated a certificate to use in Safari. Installed
the certificate in my Key-chain and added the Safari Extension to the browser.

Can refer the site for steps to proceed: https://rationaleemotions.wordpress.com/2012/05/25/working-with-safari-driver/

I am using software configurations like:
Selenium: selenium-server-standalone-2.43.1.jar
Safari: 7.1.3
Mac: 10.9.5

Even tested on latest Selenium 2.44.0 and Safari 8.0. This approach works.

Reported by udaykthakur on 2015-02-04 14:54:03

lukeis commented 8 years ago
Is there a workaround aside from signing up for the Apple Developer Program?  It's not
free to sign up, and I'd rather not pay just for the privilege of running tests against
Safari.

Reported by anastasya.knyazeva on 2015-07-09 19:22:30

lukeis commented 8 years ago

Reported by luke.semerau on 2015-09-17 17:46:34