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()