Selenium Web自动化-Node.js



如果你还没有安装Node.js,参考:Ubuntu 16.04 安装 Node.js

# 安装selenium-webdriver


如果你使用最新的Firefox (47+)版本,就目前来说,需要安装新驱动:marionette

Setting up the Marionette executable

Just like the other drivers available to Selenium from other browser vendors, Mozilla has released an executable that will run alongside the browser.


You can find the latest executable on the GitHub release page.

Even though the project has been renamed to geckodriver, many of the Selenium clients look for the old name wires. You may need to rename the executable to wires to have it picked up automatically.

Add executable to system path

The Selenium client bindings will try to locate the geckodriver (or wires) executable from the system path. You will need to add the directory containing the executable to the system path.

On Unix systems you can do the following to append it to your system’s search path, if you’re using a bash-compatible shell:

On Windows you need to update the Path system variable to add the full directory path to the executable. The principle is the same as on Unix.

# 第一个例子:打开一个网页

Selenium2 Web自动化-Node.js

# 第二个例子:使用google搜索关键子’pornhub’

Selenium2 Web自动化-Node.js




电子邮件地址不会被公开。 必填项已用*标注