The difference between Webdriver and webelement in automated test selenium

Source: Internet
Author: User

Prior to doing UI Automation testing often used in Webdriver and webelement two classes before the total feel a little silly for these two classes is not clear

Yesterday looked down before the code in combination with their own understanding of the difference between the two classes and the relationship to tidy up (welcome to make a brick) hope that the same doubts about the two classes of classmates have help

First, Webdriver.

Webdriver I understand it's a browser-driven class that encapsulates the way a browser operates, such as:

Browser open Close, window toggle, find element, get current URL, get title, forward back, etc.

Webelement I understand that it is an element class that encapsulates the operation of elements such as:

Input box input, empty, button click, element attribute acquisition, etc.

So what does Webdriver have to do with webelement? Let's see the code.

Here, a method for locating OrderID elements is encapsulated with webelement.

The formal parameter is a driver object, which is then used to find the element by means of the driver provided.

So we know that if you want to locate an element and manipulate the element, you first need to instantiate a driver with Webdriver to find the element and then use the method Webelement provides to manipulate the element.

This is what I understand the difference and relationship between Webdriver and webelement if there is a wrong place, please make a brick.

The difference between Webdriver and webelement in automated test selenium

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.