Go: Selenium2.0 Introduction--webdriver two ways to drive a browser

Source: Internet
Author: User
Tags selenium grid

If you are familiar with selenium RC, understand how selenium RC works, then, when the first contact selenium Webdriver, see Webdriver Incredibly can not need to specify the remote server IP address and port number, will be surprised.

In fact, Webdriver has two ways to "drive" the browser.
1. Selenium server: As with Selenium RC, this remote server drives the browser by specifying the remote server IP address and port number.
2. Call directly: You do not need to specify any server IP address and port number. Use a local browser directly (just install the appropriate browser, ie, Firefox, Chrome)

So how do you decide which way to use it? Quite simply, if you only need to run the automated case on this machine, you don't need to use selenium Server.

You may need to use selenium Server in the following cases:
1. There is no browser you want to run, such as the code is running on the Linux platform, and you want to test the browser is the Windows platform IE
2. Use selenium grid to deploy multiple browsers and run case concurrently to reduce case run time.

The difference between the client code on the call (in Java, for example)

Do not use selenium Server:

Webdriver Driver = new Firefoxdriver ();

Using Selenium Server:

Desiredcapabilities capabilities = new Desiredcapabilities ("Firefox", "", Platform.any);
Webdriver Driver = new Remotewebdriver (New URL ("http://127.0.0.1:4444/wd/hub/"), capabilities);

Obviously ha, if you use Selenium server, you need to start selenium server remotely.

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.