element positioning
Element positioning is the core of automated testing. If you want to operate an element, you should first identify this element. webdriver provides a series of element positioning methods, commonly used are the following:
- id
- name
- class name
- link text
- partial link text
- tag name
- xpath
- css selector
id and name positioning
The final code is as follows:
problems encountered
Question 1:
During the execution of the code, the following error was encountered: "selenium.common.exception.InvalidArgumentException: Message: Expected [object Undefined] undefined to be a string"
Baidu searched, and the Internet said that the version of webdriver and Firefox browser may be incompatible. My selenium is 3.5.0, the browser driver is: geckodriver (not sure what version), and the Firefox version is: 53.0.3 (64-bit). After I updated the version of geckodriver to v0.18.0 (64-bit), the problem was solved.
Question 2:
During the execution of the code, the following error was encountered: "selenium.common.exceptions.WebDriverException: Message: quit"
My selenium is 3.5.0, the browser driver is: geckodriver version is: v0.18.0 (64 bit) , Firefox version is: 53.0.3 (64 bit). Updating the Firefox version to 54.0 (64-bit) solved the problem.