1. In the actual testing process, the actual results are often compared with the expected results.
2. If the actual result is inconsistent with the expected result, it is considered a bug
Selenium is widely used in B/s architecture, how to verify the correctness of test results by selenium.
- Case study: Take Baidu as an example, together to see how to verify the correctness of the test results.
- Click on the homepage of Baidu "hao123" after;
- Skip to "hao123" page
- Verify: Jump to "hao123" page
- How to implement the scene through selenium?
#******************# 获取验证信息,操作某页面后,确认进入的是期望结果#******************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_上网从这里开始"if Second_Title == Expect_Title: print(True)else: print(False)driver.quit()
- Selenium through Driver.title Check the title of the page;
- Determine if the actual page title value is the same as expected;
- The results of the test are thus obtained.
If you want the system to learn selenium, you can pass the way oh ...
The promotion of my blog column, currently selected a topic "from the zero-learning selenium automated testing Framework," Please add a link description, let us from the code, step to implement the Web Automation test framework
The project will build a usable automated testing framework from scratch (based on python+selenium)
The premise: You have to master Python and Selenium Foundation Oh. Or you can not understand.
Test result verification of selenium automation test