TA的每日心情 | 慵懒 2021-12-24 13:41 |
---|
签到天数: 314 天 连续签到: 1 天 [LV.8]测试军长
|
你的代码写的有问题,可以试试下面,对照下
pub2.py文件
#coding=utf-8
class Login():
def user_login(self,driver):
driver.find_element_by_id("userNameIpt").clear()
driver.find_element_by_id("userNameIpt").send_keys("username")
driver.find_element_by_id("pwdInput").clear()
driver.find_element_by_id("pwdInput").send_keys("password")
driver.find_element_by_id("btnSubmit").click()
def user_quit(self,driver):
driver.find_element_by_link_text("退出").click()
driver.quit()
163test.py文件
#coding=utf-8
from selenium import webdriver
from pub2 import Login
import time
driver=webdriver.Firefox()
driver.get("http://email.163.com/#from=163nav_icon")
time.sleep(10)
Login().user_login(driver)
Login().user_quit(driver)
|
|