picture


- "Software Testing Dry Goods TOP3" Issue 263-
Ding~ Lemon Class's new column technology "Dry Goods TOP3" is here !

In  "Dry Goods TOP3"
One point of knowledge
Answer your most concerned software testing questions in 5 minutes
Simple, clear and easy to learn dry goods
All the software testing issues you care about are here!
picture

1) Initialize the browser object


When initializing the driver object, selenium4 has an additional Service class to manage the start and stop of the driver.

service =
Service(r"E:\python39\chromedriver.exe")
driver = webdriver.Chrome(service=service)

2) Element positioning strategy

Selenium4 added relative positioning strategy
For details, please refer to the test article: selenium4 - 8 classic positioning, new relative positioning
http://testingpai.com/article/1656596898915
(Click at the end of the article to read the original text to jump directly)

Official address:
https://www.selenium.dev/documentation/webdriver/elements/locators/

3) Find element method

Selenium4 is simplified, only the two methods of find_element and find_elements are retained.
In selenium3, in addition to the above two, there are find_element_by_XXX, find_elements_by_XXXX.

In fact, in the code of selenium3, the methods of find_element/elements_by_XXX are directly called find_elment and find_elements methods.

4) expected_condition module

In the expected_condition module of explicit waiting, selenium4 implements each condition in the form of a function.

In selenium 3, each condition is implemented through a class. There are 2 magic functions in the class, one is __init__, the other is __call__, of course, some other conditional methods have been added.

5) ActionChains class

-- Both selenium4 and appium2 use the ActionChains class to complete mouse operations, touch screen operations, and multi-touch operations.

In appium1, the touch screen operation TouchAction and MultiAction are implemented, and in appium2, the ActionChains class is changed to complete.

The implementation of ActionChains has also changed, please refer to the related article: Freshly released: appium2.0+ single-touch and multi-touch new solutions.

picture
Did you learn the little knowledge today?
Welcome to interact with us in the message area~

picture