Tag: 谷歌铬

如何为Chrome构建远程Webdriver

我正在尝试对Chrome运行我的Selenium测试。 当我在本地初始化驱动程序时: @driver = Selenium::WebDriver.for( :chrome ) 一切正常(我已经将Chrome二进制文件放在我的PATH上)但是当我尝试远程启动时: @driver = Selenium::WebDriver.for(:remote, :url => ‘http://’ + SELENIUM_HOST + port + webdriver_hub, :desired_capabilities => :chrome) 我收到以下错误 Selenium :: WebDriver :: Error :: UnhandledError:chromedriver可执行文件的路径必须由webdriver.chrome.driver系统属性设置; 有关详细信息,请参阅http://code.google.com/p/selenium/wiki/ChromeDriver 。 最新版本可以从http://code.google.com/p/chromium/downloads/list下载(java.lang.IllegalStateException) 我在那里有点困惑 – 我究竟应该如何设置这个系统属性? 我发现这段代码用Java编写: DesiredCapabilities caps = DesiredCapabilities.chrome(); caps.setJavascriptEnabled(true); caps.setCapability(“chrome.binary”, “/path/to/where/chrome/is/installed/chrome.exe”); System.setProperty(“webdriver.chrome.driver”,”/path/to/where/you/ve/put/chromedriver.exe”); ChromeDriver driver = new ChromeDriver(caps); 但我的测试是用Ruby编写的。 RubyBindings没有谈论这个问题http://code.google.com/p/selenium/wiki/RubyBindings

Selenium Webdriver和Chrome驱动程序 – 无法运行chrome驱动程序

我正在尝试运行一个ruby文件,它将使用selenium webdriver启动chrome驱动程序。 我有selenium独立服务器2.35.0。 和chromedriver可执行文件安装。 我正在通过运行启动服务器, java -jar ./selenium-server-standalone-2.35.0.jar -Dwebdriver.chrome.bin=/usr/bin/google-chrome -Dwebdriver.chrome.driver=/home/./chromedriver & 两个会话正在启动,Chrome驱动程序无法启动。 05:07:34.328 INFO – Executing: [new session: {platform=ANY, javascriptEnabled=tr ue, cssSelectorsEnabled=true, browserName=chrome, nativeEvents=false, rotatable= false, takesScreenshot=false, version=, chrome.switches=[–ignore-certificate-er rors]}] at URL: /session) 05:07:34.329 INFO – Creating a new session for Capabilities [{platform=ANY, cssS electorsEnabled=true, javascriptEnabled=true, browserName=chrome, nativeEvents=f alse, rotatable=false, takesScreenshot=false, chrome.switches=[–ignore-certific ate-errors], version=}] Starting […]

Chrome 62和Flash

我有一个基于Flash的应用程序,我需要使用Cucumber进行测试。 由于默认情况下未启用闪存,因此我需要在每次测试之前启用它,并将我认为的url列入白名单。 如果我暂停测试的后台阶段,我可以手动设置这些选项。 我怎么能自动化这种方法,我已经考虑过添加options和preferences ,但似乎仍然无法开始工作。 所以这是我在env.rb文件中的标准设置 Capybara.register_driver :chrome do |app| chrome_binary = ‘/Applications/Google Chrome.app’ capabilities = Selenium::WebDriver::Remote::Capabilities.chrome(“chromeOptions” => { “binary” => chrome_binary + ‘/Contents/MacOS/Google Chrome’ }) Capybara::Selenium::Driver.new(app, :browser => :chrome, :desired_capabilities => capabilities, :options => options) end 进一步阅读强调了诸如此类的选项 options = Selenium::WebDriver::Chrome::Options.new options.add_argument(‘arg-here’) prefs = {“enable flash here ? “} options.add_experimental_option(“prefs”, prefs) undefined method add_experimental_option for […]