Selenium :: WebDriver :: Error :: WebDriverError: [英] Selenium::WebDriver::Error::WebDriverError:

查看:132
本文介绍了Selenium :: WebDriver :: Error :: WebDriverError:的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试对JavaScript代码进行一些验收测试。但是,当我尝试将Capybara与Selenium结合使用时,会一直得到以下内容:

I am trying to run some acceptance tests for javascript code. However, when I tried using Capybara with Selenium, I kept getting the following:

>> Thin web server (v1.3.1 codename Triple Espresso)
>> Maximum connections set to 1024
>> Listening on 0.0.0.0:1234, CTRL+C to stop
FF>> Thin web server (v1.3.1 codename Triple Espresso)
>> Maximum connections set to 1024
>> Listening on 0.0.0.0:1234, CTRL+C to stop
F

Failures:

  1) end to end acceptance test shows that x wins when it does
     Failure/Error: @application.start
     Selenium::WebDriver::Error::WebDriverError:
       Unable to find the chromedriver executable. Please download the server from http://code.google.com/p/chromedriver/downloads/list and place it somewhere on your PATH. More info at http://code.google.com/p/selenium/wiki/ChromeDriver.>> Thin web server (v1.3.1 codename Triple Espresso)
     # ./spec/acceptance/application_driver.rb:24:in `start'
     # ./spec/acceptance/end_to_end.rb:6:in `block (2 levels) in <top (required)>'

下面的代码是什么应该启动驱动程序。我从 http://code.google.com/p/chromedriver/downloads下载了相应的文件/ list ,然后通过运行PATH = $ PATH:/ directory / where / chromedriver / exists并导出PATH将其放置在Path中,并使它可执行,但仍然出现错误。

The code below is what is supposed to start the driver. I downloaded the appropriate file from http://code.google.com/p/chromedriver/downloads/list and I placed it in my Path by running PATH=$PATH:/directory/where/chromedriver/exists and export PATH, and made it executable but still got the error. Is there something I am missing?

Capybara.register_driver :chrome do |app|
  Capybara::Selenium::Driver.new(app, :browser => :chrome)
end

Capybara.default_driver = :chrome

class TicTacToeApplicationDriver
  include Capybara::DSL
  include Capybara::RSpecMatchers

  APPLICATION_PORT = 1234

  def initialize
    @application_server = ApplicationServer.new
  end

  def start
    @application_server.start
    visit "http://localhost:#{APPLICATION_PORT}/index.html"
  end


推荐答案

我不知道capybera,但是为此错误,您可以检查2件事

I don't know capybera, but for this error you can check 2 things


  1. 请确保已提供完整路径,包括chromedriver.exe(如果是chromedriver,您在Linux中)。如果在Windows中,还需要指定.exe。

  1. Make sure you have given the full path including the filename to chromedriver.exe (or chromedriver if you are in linux). If in windows you need to specify the .exe also.

如果您使用的是remotewebdriver,而不是更新path变量,则可以尝试在输入您启动硒服务器。像

If you are using remotewebdriver, rather than updating the path variable, you can try giving this path while you start the selenium server. Like




java -jar selenium.jar
-Dwebdriver.chrome。 driver = fullpathtoexefileincludefilename

java -jar selenium.jar -Dwebdriver.chrome.driver=fullpathtoexefileincludingfilename

这篇关于Selenium :: WebDriver :: Error :: WebDriverError:的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆