use*_*934 3 ruby macos selenium-chromedriver
请帮忙!
我正在尝试使用Ruby和Selenium Web驱动程序运行我的测试脚本.
require "selenium-webdriver"
driver = Selenium::WebDriver.for :chrome
driver.navigate.to "google.com"
driver.quit
Run Code Online (Sandbox Code Playgroud)
但它给了我一个错误
Unable to find the chromedriver executable. Please download the server from http://chromedriver.storage.googleapis.com/index.html and place it somewhere on your PATH. More info at https://github.com/SeleniumHQ/selenium/wiki/ChromeDriver. (Selenium::WebDriver::Error::WebDriverError)
Run Code Online (Sandbox Code Playgroud)
我已经安装了chromedriver并将其解压缩到目录〜/ webdrivers中.并将路径添加到路径中以增加路径.然后我尝试将chromedriver移动到〜/ bin目录并将其放在PATH中.
没有任何效果.我仍然得到错误.
谢谢.
1 - 下载ChromeDriver可执行文件.
2 - 创建自己的PATH到mac上的唯一文件夹,或将文件复制到现有的PATH目录.去做这个:
a - Open up Terminal
b - Run sudo nano /etc/paths
c - Enter your password
d - Go to the bottom of the file and enter the path you wish to add
e - My PATH looks like: /Users//Documents/WebDriver
f - Control-x to quit
g - Y to save
Run Code Online (Sandbox Code Playgroud)
要仔细检查,请退出终端并重新启动它.运行echo $ PATH.您应该已经在其他路径的流中看到新添加的路径.
最后,更新您的测试以使用ChromeDriver(包括代码段)运行并运行测试!
另一个提示:如果你在Mac上使用brew我会推荐brew install chromedriver.
重新安装后重新运行"selenium-standalone install"
| 归档时间: |
|
| 查看次数: |
3236 次 |
| 最近记录: |