在Mac Chrome上使用Selenium [英] Using Selenium on Mac Chrome
问题描述
如果您想使用Selenium WebDriver使用Chrome,首先下载ChromeDriver - WebDriver for Chrome。这可以通过Homebrew通过 brew install chromedriver
来安装,或者通过下载,解压,移动和设置 PATH
为手动安装如下:
$ cd $ HOME / Downloads
$ wget http://chromedriver.storage.googleapis.com/ 2.22 / chromedriver_mac32.zip
$ unzip chromedriver_mac32.zip
$ mkdir -p $ HOME / bin
$ mv chromedriver $ HOME / bin
$ echoexport PATH = $ PATH: $ HOME / bin>> $ HOME / .bash_profile
来源: 在Mac或Linux上安装并设置路径到chromedriver
然后,您应该阅读入门在桌面上使用ChromeDriver ,特别是示例代码,该代码展示了如何将路径映射到可执行文件并实例化 ChromeDriver
。如果您在 PATH
变量中引用了驱动程序,则可以省略配置行。
您可以通过ChromeDriver安装打包(.crx文件)和解包(目录)扩展。请参阅代码片段,以设置此处。
如果您使用Selenium IDE代替FireFox,则没有适用于Chrome的版本。我知道的最佳选择是 iMacros for Chrome 。
Recently got a mac and was able to run Mozilla without any issues but having trouble installing chrome extensions and running it for selenium. Can someone guide me through the process of installing the extension and running selenium on Mac chrome.
If you want to use Selenium WebDriver with Chrome, first download ChromeDriver - WebDriver for Chrome. This can be installed via Homebrew with brew install chromedriver
, or manually by downloading, extracting, moving and setting the PATH
as follows:
$ cd $HOME/Downloads
$ wget http://chromedriver.storage.googleapis.com/2.22/chromedriver_mac32.zip
$ unzip chromedriver_mac32.zip
$ mkdir -p $HOME/bin
$ mv chromedriver $HOME/bin
$ echo "export PATH=$PATH:$HOME/bin" >> $HOME/.bash_profile
Source: install and set path to chromedriver on mac or linux
You should then read Getting started with ChromeDriver on Desktop, in particular the sample code which shows how you map the path to the executable and instantiate ChromeDriver
. If you have a reference to the driver in the PATH
variable, you can omit the configuration line.
You can install both packed (.crx file) and unpacked (directory) extensions via ChromeDriver. See the code snippets for setting either up here.
If you were using Selenium IDE for FireFox instead, there is no version available for Chrome. The best alternative I know of is iMacros for Chrome.
这篇关于在Mac Chrome上使用Selenium的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!