Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

Verification of test results of selenium automated testing

Shulou Source: shulou.com Published: 2022-06-03 07:01:58 10月06日 Update

1. In the actual testing process, it is often necessary to compare whether the actual results are consistent with the expected results.

two。 If the actual result is inconsistent with the expected result, it is considered as bug.

Selenium is widely used in Bhand S architecture, how to verify the correctness of test results through selenium.

Case study: take Baidu as an example to see how to verify the correctness of the test results. After clicking "hao123" on the home page of Baidu, jump to the "hao123" page to verify: whether to jump to the "hao123" page how to achieve this scenario through selenium? # * # obtain verification information, and after manipulating a page Confirm that you entered the expected result # * from selenium import webdriverfrom time import sleepdriver = webdriver.Firefox () driver.get ("http://www.baidu.com")print("===========The baidu Page=") First_Title = driver.titleprint ("The first page title is:%s"% First_Title) print ("= The hao123 Page=") driver.find_element_by_xpath ("/ a [@ name='tj_trhao123'") ] "). Click () Second_Title = driver.titleprint (" The Second page title is:%s "% Second_Title) Expect_Title =" hao123_ access starts here "if Second_Title = = Expect_Title: print (True) else: print (False) driver.quit () selenium checks the title of the page through driver.title Determine whether the title value of the actual page is the same as the expected value; thus get the test results. If you want to learn selenium systematically, you can do it in such a way.

To promote my blog column, I have selected a topic "learn from Zero Selenium Automated Test Framework". Please add a link description. Let's start with the code and implement the Web automated testing framework step by step.

This project will build an available automated testing framework (based on python+selenium) from scratch.

Premise: you should master the basics of python and selenium. Or you won't understand.

Tags: Results tests pages validation reality expectations automation frameworks consistency correctness same columns topics thematic meetings topics code information premises blogs can be accessed through the Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Redmi NVidia Linux MariaDB Shulou Tech Info