本文共 1480 字,大约阅读时间需要 4 分钟。
selenium 火狐版本
To set up Selenium, you’ll first need to have Python installed. Check out my if you need help with that.
要设置Selenium,首先需要安装Python。 查看我的 如果您需要帮助。
Next, you need to install Selenium. To do this, simply open up your Windows command prompt or Mac/Linux terminal and type:
接下来,您需要安装Selenium。 为此,只需打开Windows命令提示符或Mac / Linux终端,然后键入:
pip install selenium
Now that Selenium is installed, you need to pick a web browser for Selenium to use. Firefox and Chrome are both just as easy to use with Selenium, but here we’ll look at using Firefox. Assuming you have the Firefox browser installed on your machine, go to the following webpage:
现在已经安装了Selenium,您需要选择一个Web浏览器供Selenium使用。 Firefox和Chrome都可以与Selenium一起轻松使用,但在这里我们将介绍如何使用Firefox。 假设您的计算机上已安装Firefox浏览器,请转到以下网页:
Click to download the appropriate “gecko driver” zip file for your machine. Unzip the driver and move it to whatever place in your file system you prefer. Just keep in mind you will need to reference the gecko driver’s location when you use Selenium.
单击以下载适合您的计算机的“ gecko驱动程序” zip文件。 解压缩驱动程序并将其移动到文件系统中您喜欢的任何位置。 请记住,使用Selenium时,您需要参考壁虎驱动程序的位置。
Finally, to make sure everything is working as it should, run this code:
最后,要确保一切正常,请运行以下代码:
from selenium import webdriver# your executable path is wherever you saved the gecko webdrivergeckodriver = "C:UsersgstantonDownloadsgeckodriver.exe"browser = webdriver.Firefox(executable_path=geckodriver)url = "https://www.duckduckgo.com"browser.get(url)
翻译自:
selenium 火狐版本
转载地址:http://xeqwd.baihongyu.com/