在Ruby on Rails项目中,我发现这个方法的目标是根据环境检索Selenium驱动程序。 (开发,测试或生产)这两种设置Selenium驱动程序的方式有什么区别?
def driver
@driver ||= begin
if Rails.env.production?
driver = Selenium::WebDriver.for :remote, url: 'http://localhost:4444/wd/hub'
else
driver = Selenium::WebDriver.for :firefox
end
driver.manage.timeouts.implicit_wait = 1
driver
end
end
当然,我读的官方文档,但还是没有出现非常明确:
http://code.google.com/p/selenium/wiki/RemoteWebDriver - http://code.google.com/p/selenium/wiki/FirefoxDriver
是什么(这两种方式之间的差异远程和Firefox)?
特别是,对于被删除的方式,为什么将指向的主机设置为localhost ......的确,如果选择localhost,为什么不选择firefox驱动程序呢?