selenium3 automated testing framework: setting up the environment - use title_contains check the page correctly

Learning objectives:

Have some basic web operations automation framework needed

Official steps:

step1: the following sample code, as detailed code comments

# - * - Coding: UTF-. 8 - * - 
Import Time
 from Selenium Import the webdriver
 from selenium.webdriver.support Import expected_conditions EC AS 

DR = webdriver.Chrome () 
URL = " https://www.baidu.com " 
DR. GET (url) 
# check title contains check the contents of 
a = EC.title_contains ( " Baidu, you know " )
 # If included in brackets, it will print 
IF a:
     Print ( " title right " ) 
the time.sleep ( . 3  )
dr.Close ()

 

Guess you like

Origin www.cnblogs.com/wuzhiming/p/11657091.html