I can't establish a session with Safari Technology Preview (STP) using Capybara and Selenium. Capybara won't even open a browser window.
I've upgraded to Ruby 2.3.0 Capybara 2.14.2 Selenium 3.4.0
I downloaded and installed STP from https://developer.apple.com/safari/download/
I am trying to use the following code:
Capybara.register_driver :selenium do |app|
Capybara::Selenium::Driver.new(
app,
browser: :safari
)
end
Capybara.default_driver = :selenium
How do I initialize Capybara to use the STP safaridriver that has implemented the W3C standards for automation?
To get this to work I used the following code:
#This is what we use to test the Safari release channel.
#You will have to install Safari Technology Preview (STP) from Apple.
#see standard properties here: https://www.w3.org/TR/webdriver/#capabilities
#STP requires a capabilities object
#you could use any of the properties from the link above.
#I just used a accept_insecure_certs for the heck of it
desired_caps = Selenium::WebDriver::Remote::Capabilities.safari(
{
accept_insecure_certs: true
}
)
Capybara.register_driver :selenium do |app|
Capybara::Selenium::Driver.new(
app,
browser: :safari,
driver_path: '/Applications/Safari Technology Preview.app/Contents/MacOS/safaridriver',
desired_capabilities: desired_caps
)
end
Capybara.default_driver = :selenium