上一节写到用元素去做事情,但是都是分开的,现在我们把事情串联起来
from register_handel import LoginHandle
class RegisterBuss(object):
def __init__(self, driver):
self.register = LoginHandle(driver)
self.driver = driver
def login(self, num, pwd):
self.register.send_num(num)
self.register.send_pwd(pwd)
self.register.click_en()
另一种思路的解法(此解法不需要上一节的handel操作层,直接读取返回元素,但是要记得填(user_name)
from handel import RegisterHandle
from readinfo import ReadInfo
class Business(object):
def __init__(self, driver):
self.driver = driver
self.reg = RegisterHandle(self.driver)
self.re = ReadInfo(self.driver)
def login(self, num, pwd):
self.re.readinfo('user_name').send_keys(num)