selenium的簡單登錄操作


from selenium import webdriver
driver = webdriver.Chrome()
#首頁
#driver.get('http://39.98.138.157/shopxo/index.php')
#登錄頁面
driver.get('http://39.98.138.157/shopxo/index.php?s=/index/user/logininfo.html')
#定位到用戶名輸入框
we_input = driver.find_element_by_xpath("//input[@class='am-radius']")
#輸入用戶名
we_input.send_keys('666666')
#定位到密碼輸入框
we_password = driver.find_element_by_xpath("//input[@name='pwd']")
#輸入密碼
we_password.send_keys('111111')
#定位到登錄按鈕
we_button = driver.find_element_by_xpath("//button[@class='am-btn am-btn-primary am-radius am-btn-sm btn-loading-example']")
#點擊按鈕
we_button.click() 

#運行結束后釋放資源
driver.quit()
 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM