Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix most (I hope) instances of Unable to establish a connection with SafariDriver #283

Closed
wants to merge 1 commit into from

Conversation

dimacus
Copy link

@dimacus dimacus commented Nov 14, 2014

Tested on:

  • OSX 10.8.5
  • OSX 10.10
  • Win 7 Safari 5.1.7

Issues: #7933, #7963, #7974, 7801

Refactor how the extension installation happens by splitting the
installer into multiple Platform specific installers. If the installation
still fails, provide a much more detailed explanation as to why the failure
occurred and suggestions how to fix it.

Conflicts:
java/client/src/org/openqa/selenium/safari/SafariExtensions.java

Issues: SeleniumHQ#7933, SeleniumHQ#7963, SeleniumHQ#7974, 7801

Refactor how the extension installation happens by splitting the
installer into multiple Platform specific installers. If the installation
still fails, provide a much more detailed explanation as to why the failure
occurred and suggestions how to fix it.

Conflicts:
	java/client/src/org/openqa/selenium/safari/SafariExtensions.java
@dimacus
Copy link
Author

dimacus commented Nov 19, 2014

Did more digging on Unmanaged jobs may not make XPC Events requests, it seems that permissions on the system for some system files are not correct.

Try this
find ~ $TMPDIR.. \( -flags +sappnd,schg,uappnd,uchg -o ! -user $UID -o ! -perm -600 \) 2>&- | wc -l

if the return is anything but 0, you should run this to fix permission

sudo find ~ $TMPDIR.. -exec chflags -h nouchg,nouappnd,noschg,nosappnd {} + -exec chown -h $UID {} + -exec chmod +rw {} + -exec chmod -h -N {} + -type d -exec chmod -h +x {} + 2>&-
see if that fixes it.

Source: https://discussions.apple.com/thread/6557647

@bharatn
Copy link

bharatn commented Nov 20, 2014

Tried and no luck

/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/atoms/error.js:113
var template = new Error(this.message);
^
UnknownError: Failed to connect to SafariDriver after 10069 ms
Build info: version: '2.43.1', revision: '5163bce', time: '2014-09-10 16:27:33'
System info: host: 'xx', ip: '127.0.0.1', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.10.1', java.version: '1.7.0_45'
Driver info: driver.version: SafariDriver
at new bot.Error (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/atoms/error.js:113:18)
at Object.bot.response.checkResponse (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/atoms/response.js:106:9)
at /usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/webdriver.js:151:24
at /usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/base.js:1582:15
at webdriver.promise.ControlFlow.runInNewFrame_ (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:1640:20)
at notify (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:444:12)
at notifyAll (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:422:7)
at resolve (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:400:7)
at fulfill (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:512:5)
at /usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/base.js:1582:15
==== async task ====
WebDriver.createSession()
at Function.webdriver.WebDriver.acquireSession_ (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/webdriver.js:148:22)
at Function.webdriver.WebDriver.createSession (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/webdriver.js:122:30)
at Builder.build (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/builder.js:293:22)
at HostedDriverProvider.getDriver (/usr/local/lib/node_modules/protractor/lib/driverProviders/hosted.js:63:9)
at /usr/local/lib/node_modules/protractor/lib/runner.js:238:41
at _fulfilled (/usr/local/lib/node_modules/protractor/node_modules/q/q.js:797:54)
at self.promiseDispatch.done (/usr/local/lib/node_modules/protractor/node_modules/q/q.js:826:30)
at Promise.promise.promiseDispatch (/usr/local/lib/node_modules/protractor/node_modules/q/q.js:759:13)
at /usr/local/lib/node_modules/protractor/node_modules/q/q.js:573:44

@bharatn
Copy link

bharatn commented Nov 21, 2014

Sorry that(permissions and/or updating the driver) did fix the issue

@juangj
Copy link
Contributor

juangj commented Dec 10, 2014

Do you think you'll have time to come back to this? It seems like feedback has sort of dried up on the Selenium bug (7933), but I'm interested in getting this fixed and hopefully can offer some debugging help.

I'm on OSX 10.9.5 and Safari 7.1. Using the AppleScript installation method worked for me, after clicking a couple buttons manually to allow Accessibility features and access to the keychain. That is, I just changed isYosemiteOrHigher to check for minorVersion >= 9. And renamed it isMavericksOrHigher, I guess :)
(It'd be nice to grant those permissions programmatically somehow, but I imagine that from Apple's perspective, it's intentionally difficult.)

It could be that the DefaultMacInstaller method still works with older versions of Safari, regardless of OS version, though I haven't confirmed that -- I can attempt to try it on OSX 10.9.5 + Safari 7.0.6 if that's helpful. (It's possible but non-trivial for me to get access to such a machine, so I'm not 100% sure I can test that.) If that's the case, I guess you might need to check both the OS version and browser version before choosing an installation method...?

Also, just to confirm, I also see that "Unmanaged jobs may not make XPC Events requests" in the Console and it doesn't seem to do any harm.

@dimacus dimacus closed this Feb 2, 2015
@jleyba
Copy link
Contributor

jleyba commented Feb 2, 2015

Follow-up: @dimacus closed this b/c we've decided to drop auto-installation of the SafariDriver and require users to manually install the extension. Working with the keychain was proving to be too complicated and fragile to be a sustainable option.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants