Python+selenium Browser calls (Chrome, IE, Firefox)

Source: Internet
Author: User

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)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.