The content in this part will be a demonstration of the positioning Element Method in WebDriver, which is a combination of methods used in the WebDriver of Selenium element locating command.
For a review of element locating methods in Selenium, refer:
The positioning and operation of the test object is the core content of webdriver, and the operation is based on the positioning, so object positioning becomes more and more important.
Objects are usually located for the following purposes:
- Operation object
- Obtains the attributes of an object, such as the class attribute and name attribute of the test object.
- Obtain the text of an object
- Get the number of objects
Webdriver provides a series of object locating methods, which are commonly used in the following scenarios:
- Id
- Name
- Class name
- Link text
- Partial link text
- Tag name
- Xpath
- Css selector
The HTML code used for locating the example is as follows:
Form simple login form Email Password Sign in register
The Python script is as follows:
selenium time os.environ: os.environ[== + os.path.abspath(dr.find_element_by_id(dr.find_element_by_name(dr.find_element_by_tag_name().get_attribute(e = dr.find_elements_by_class_name(5link = dr.find_element_by_link_text(5link = dr.find_element_by_partial_link_text(5div = dr.find_element_by_css_selector(55