Test result verification of selenium automation test

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.