PC Automation based on Selenium2+java (2)-Launch browser

Source: Internet
Author: User

First, the preparatory work

There are three main browsers we use: Chrome, Firefox, ie, chrome and IE need to download drivers to start the browser, note that the driver has 32-bit and 64-bit two.

In addition: How to view the browser version of the machine;
(1) IE: Check the installation path, if it is installed in Program Files (x86), 32-bit, if installed in program files, represents 64 bits;
(2) Chrome: In the Google browser address bar input: chrome:version, and then enter, there will be detailed display:

qq picture 20161115202252.png1164x391 21.1 KB
(3) Firefox: In the Firefox address bar input: about:buildconfig, and then enter, with detailed display:qq picture 20161115202809.jpg844x534 31.8 KB

To prepare the driver:
Can be downloaded from the Internet
(1) ie:http://docs.seleniumhq.org/download/1
(2) chrome:http://chromedriver.storage.googleapis.com/index.html?path=2.9/5
There are also cloud disk Links: https://pan.baidu.com/s/1eS5JpK22
(Here the ChromeDriver.exe is 32-bit, Iedriver is 64-bit);

Selenium and browser compatibility issues, the browser version is not too high, especially the Firefox browser, I am using the 33 version, and set do not check the update: Https://pan.baidu.com/s/1dFytKIX8

Second, start the Firefox browser

Because the Firefox browser does not require a driver, it can be started directly.

(1) Start the Firefox browser under the default installation path;

1.png1105x832 86.5 KB

(2) launch a custom path to install the Firefox browser;

Custom road installation, you need to set the system property value: Set the browser's installation location to the system properties.

2.png1263x864 95.9 KB

Third, start the Chrome browser

Description: The Chrome browser needs to rely on the driver for booting, so the driver's path is set to the System Properties (Webdriver.chrome.driver) before starting the browser.

(1) Launch Google Chrome;

3.png1275x947 KB

(2) If you do not want to use the SetProperty way, you can also put Chromedriver.exe in the "C:\Windows\System32" path and restart the computer can be.

Four, start IE browser

Description: The start of IE browser, also need to rely on the driver, and IE driver is divided into 32-bit and 64-bit, this need according to their native browser to clear and choose the correct, the driver of the road to the System Properties (Webdriver.ie.driver);

IE browser start, need to pay special attention, be sure to close the browser protection mode;

qq picture 20161115211739.png1146x765 148 KB

Of course, we do not need to manually protect the mode, you can start the browser process, the browser to set the startup parameters, remove the protection mode;

qq picture 20161115213803.png1593x941 146 KB

The final explanation: every browser launched by selenium is a clean browser that does not have any plugins or cookie information. If you need to start a browser with plug-ins, as well as other configurations, it is easy to add parameter configuration at startup, and then explain it later.

   更多详情请关注公众号“软件测试部落”


史上第一个以“持续集成”方向为主的网址:www.hordehome.com

PC Automation based on Selenium2+java (2)-Launch browser

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.