Reputation: 21
I want to run my selenium/java scripts on safari browser.
Local runs work fine (Im able to see safari launch & scripts work fine).
But I am facing an issue when I try to run it through Jenkins. It errors out at this statement , does not launch safariBrowser driver = new SafariDriver(options);
Please note, Im able to run the scripts fine, when I login to the VM, and try to run on the VM. But when the scripts are triggered through Jenkins, it errors out.
This is my code :
SafariOptions options = new SafariOptions();
options.setCapability(CapabilityType.SUPPORTS_JAVASCRIPT, "true");
driver = new SafariDriver(options);
Error thrown :
org.openqa.selenium.WebDriverException:
java.net.ConnectException: Failed to connect to localhost/127.0.0.1:9504
Build info: version: '3.12.0', revision: '7c6e0b3', time: '2018-05-08T14:04:26.12Z'
System info: host: 'mac10-14-886479', ip: '10.0.10.253', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.14.6', java.version: '1.8.0_181'
Driver info: driver.version: SafariDriver
Caused by: java.net.ConnectException: Failed to connect to localhost/127.0.0.1:9504
Caused by: java.net.ConnectException: Connection refused (Connection refused)
Other alternative tried : Tried to check in other stackoverFlow posts. I found few posts which says to launch safariDriver using automator script. But when I try to launch a safariDriver using automator script, I can see a "safariDriver" process started in the "activity monitor", But when my scripts run, there's no way to hook up to the same port, and use the already running safariDriver This is the automator script that was used :
security unlock-keychain -p '<password>'
/usr/bin/safaridriver --enable
/usr/bin/safaridriver --port 7050
Any help on this is much appreciated !
Upvotes: 0
Views: 318
Reputation: 193108
This error message...
org.openqa.selenium.WebDriverException:
java.net.ConnectException: Failed to connect to localhost/127.0.0.1:9504
Build info: version: '3.12.0', revision: '7c6e0b3', time: '2018-05-08T14:04:26.12Z'
System info: host: 'mac10-14-886479', ip: '10.0.10.253', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.14.6', java.version: '1.8.0_181'
Driver info: driver.version: SafariDriver
Caused by: java.net.ConnectException: Failed to connect to localhost/127.0.0.1:9504
Caused by: java.net.ConnectException: Connection refused (Connection refused)
...implies that the WebDriver was unable to communicate with the Browsing Context i.e. Browser session.
Your main issue is the incompatibility between the version of the binaries you are using as follows:
java.version: '1.8.0_181'
'3.12.0
' of 2018-05-08T14:04:26.12Z which is old and ancient.Ensure that:
Upvotes: 0