Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

Selenium Learning: getting validation Information

Shulou Source: shulou.com Published: 2022-06-03 07:18:40 11月23日 Update

The ways to gain confidence in verification are: title URL text

From selenium import webdriverfrom time import * driver = webdriver.Chrome () url = 'http://home.51cto.com/index?reback=http://9603083.blog.51cto.com/'driver.get(url)# print current page title = driver.titleprint (title) # print current page URLnow_url = driver.current_urlprint (now_url) # execute login driver.find_element_by_xpath (' / * [@ id= "loginform-username"]'). Clear () driver. Find_element_by_xpath ('/ / * [@ id= "loginform-username"]'). Send_keys ('91ctt') driver.find_element_by_xpath (' / / * [@ id= "loginform-password"]'). Clear () driver.find_element_by_xpath ('/ / * [@ id= "loginform-password"]'). Send_keys ('CTT1106648034') driver.find_element_by_xpath (' / / * [@ id= "login-form"] / div [3] / input') .click () sleep (3) # print the current page again title = driver.titleprint (title) # print the current page URLnow_url = driver.current_urlprint (now_url) # get the user name usr = driver.find_element_by_xpath ('/ html/head/meta [3]') .textprint (usr) sleep (3) driver.quit ()

Tags: Page validation confidence again method user user name login information learning Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno OPPO Reno Linux macOS MySQL Apple