Remote Selenium WebDriver not responding to Cucumber tests

♀尐吖头ヾ 提交于 2019-12-08 11:34:58

问题


I've set up a feature in cucumber and am using the @javascript tag to have it run in selenium On my dev machine selenium runs fine but because webdriver doesn't support native events on osx yet I need to hook it up to a virtual machine running ubuntu

I've got webdriver server running on my ubuntu machine

and hacked my capybara driver like so it connect to the remote server like so:

def browser
  unless @browser

    @browser = Selenium::WebDriver.for(:remote, :url => "http://192.168.1.69:4444/wd/hub", 
      :desired_capabilities => Selenium::WebDriver::Remote::Capabilities.firefox)
    #@browser = Selenium::WebDriver.for(options.delete(:browser) || :firefox, options)
    at_exit do
      @browser.quit
    end
  end
  @browser
end

When I running my test the console on my virtual machine shows somethings going on and outputs:

WebDriver remote server: INFO executing ....

But thats it the test fails after some time due to timeout

Any ideas?


回答1:


I am not sure what is causing your specific problem. But you should register your driver using the built in mechanism:

profile = Selenium::WebDriver::Firefox::Profile.new
profile["network.http.use-cache"] = false

Capybara.register_driver :firefox_ubuntu do |app|
  Capybara::Driver::Selenium.new(app,
    :browser => :remote,
    :url => 'http://192.168.1.69:4444/wd/hub',
    :desired_capabilities =>     Selenium::WebDriver::Remote::Capabilities.firefox(:firefox_profile => profile)
  )
end

and then you can switch to it using the normal mechanism:

Capybara.current_dirver :firefox_ubuntu


来源:https://stackoverflow.com/questions/4908652/remote-selenium-webdriver-not-responding-to-cucumber-tests

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!