Search code examples
capybaraselenium-grid2

getting a capybara session for a remote browser


I cannot find anything that shows the right way to pass in capabilities and create a remote session. something like the below

Capybara.default_driver = :Selenium
@session = Capybara::Session.new :selenium

Could anyone point me in the right direction on how to do this? I have seen numerous examples of how to register a remote like this https://blog.testingbot.com/2012/02/19/selenium-cucumber-capybara, but nothing to get the instance of it so that I can act on it in the code.


Solution

  • assuming you have registered the driver like in the article you listed then to create a session its just like you put in your question

    session = Capybara::Session.new :registered_driver_name
    

    If you want capybara to run the app under test itself then its

    session = Capybara::Session.new :registered_driver_name, rack_app