Code:
# Coding=utf-8 from Import webdriverdriver=webdriver. Chrome () # calls Chrome browser driver.get ('https://www.baidu.com ')print driver.titledriver.quit ()
------------------------------------------------------------------------------
If you call another browser, the code is replaced:
Driver=webdriver. Ie () #调用ie浏览器 driver=webdriver. Firefox () #调用firefox浏览器
1 run the script under Chrome, you need to put Chromedriver.exe in the Chrome browser installation directory
(also set user environment variable path:c:\users\xxxxxx\appdata\local\google\chrome\application;)
2 run the script under IE, need to put IEDriverServer.exe in IE browser installation directory
(also set user environment variables Path:c:\program files\internet Explorer)
3 run script under Firefox, direct call (under Default installation path)
Summary: Call chrome, IE browser needs to be in advance to download the corresponding driver, and put in the installation directory, while setting the environment variables
Python+selenium Browser calls (Chrome, IE, Firefox)