在Mac Chrome上使用Selenium [英] Using Selenium on Mac Chrome

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

问题描述

最近得到了一个mac,并且能够无任何问题地运行Mozilla,但是无法安装chrome扩展并在selenium上运行它。有人可以指导我通过安装扩展并在Mac上运行Selenium的过程。

解决方案

如果您想使用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屋!

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