"Selenium2+java Automation (2)"-Launch browser

Source: Internet
Author: User

1, the commonly used browser has ie,chrome,firefox, where IE and Chrome browser need to download the driver, in order to launch the browser. Note that the driver has 32 and 64-bit differences.
How to view the browser version and number of bits of the machine;
(1) IE:
Open IE browser and click on the "gear" setting icon in the top right corner, and in the drop-down menu, click on "About Internet Explorer", and a window will pop up to show the version and number of the IE browser;

The window shows the version of IE browser and the number of bits, where 32-bit IE does not display the number of bits, and 64-bit IE browser display 64-bit.

(2) Chrome:
In the Google browser address bar input: chrome:version, and then enter, there will be detailed display:

image.png735x160 4.19 KB


Note: Chrome browser driver and version have a corresponding relationship, if the driver version and browser version inconsistent, open Google Browsing with selenium to remind Chromedriver.exe to stop running.
Driver and Browser mapping table: http://blog.csdn.net/huilan_same/article/details/51896672

(3) Firefox: In the Firefox address bar input: about:buildconfig, and then enter, with detailed display:

image.png787x336 10.2 KB


Note: selenium2.0 only supports Firefox46 the following versions.

To prepare the driver:
Can be downloaded from the Internet
(1) ie:http://docs.seleniumhq.org/download/

Download the corresponding bit driver based on the number of bits in the browser;
(2) chrome:http://chromedriver.storage.googleapis.com/index.html;

image.png757x296 16.5 KB

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

image.png1021x467 26.2 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.

image.png1209x518 32.9 KB

(3) Launch the Chrome browser
A, to start the Chrome browser, you need to rely on the driver, so before starting the browser, the driver's path is set to the System Properties (Webdriver.chrome.driver).

image.png1212x426 30.1 KB


b, if you do not want to use setproperty way, you can also put Chromedriver.exe in the "C:\Windows\System32" path and restart the computer can be.

(4) Start IE 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;

image.png491x692 28.5 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;

image.png1271x505 38.2 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.

"Selenium2+java Automation (2)"-Launch browser

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.