Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/53.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 带有Ruby问题的远程WebDriver_Ruby On Rails_Ruby_Selenium_Webdriver - Fatal编程技术网

Ruby on rails 带有Ruby问题的远程WebDriver

Ruby on rails 带有Ruby问题的远程WebDriver,ruby-on-rails,ruby,selenium,webdriver,Ruby On Rails,Ruby,Selenium,Webdriver,各位 我正在尝试用Ruby设置远程webdriver。在使用Java之前,我已经广泛地使用了Selenium,但我对Ruby还很陌生。我的代码是这样的: @driver = Selenium::WebDriver.for(:remote, :url => "http://mysite:4444/wd/hub", :desired_capabilities => Selenium::WebDriver::Remote::Capabilities.firefox) @driver.nav

各位

我正在尝试用Ruby设置远程webdriver。在使用Java之前,我已经广泛地使用了Selenium,但我对Ruby还很陌生。我的代码是这样的:

@driver = Selenium::WebDriver.for(:remote, :url => "http://mysite:4444/wd/hub", :desired_capabilities => Selenium::WebDriver::Remote::Capabilities.firefox)
@driver.navigate.to homepage
我看到的问题是,浏览器在远程机器上启动,但打开时显示一个空白页面。当我在本地机器上运行相同的代码时,页面可以正常打开。我不确定我在这里错过了什么

这是我使用的selenium webdriver(0.2.1,0.1.4)的webdriver gem,我使用的是ruby ruby-1.9.2-p180,首先下载并在本地机器上运行

配置安装方法,如

def setup
  @driver = Selenium::WebDriver.for(:remote, :url => 'http://192.168.0.188:4444/wd/hub', :desired_capabilities => :chrome)
  #@driver = Selenium::WebDriver.for :chrome
  @base_url = "http://www.google.com/"
  @driver.manage.timeouts.implicit_wait = 30
  @verification_errors = []
end

然后从远程pc运行测试用例,将在本地计算机上执行。如果您有任何问题,请告诉我。

是您在A)第三台机器上测试的Web服务器,还是b)本地机器,而不是:远程机器。可能是远程计算机无法访问Web服务器。在我们深入研究文档之前,我只是想确定这不是一件简单的事情。蒂姆,非常感谢,这是一件非常简单的事情,我今天看到了。这实际上是我ruby代码中的一个简单错误。