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