|
文件一: login.py class loginback():
def input(self,name,apek):
driver.delete_all_cookies
driver.add_cookie({'name':'action_l','value':'index'})
driver.add_cookie({'name':'ak','value':name})
driver.add_cookie({'name':'apek','value':apek})
driver.add_cookie({'name':'apk','value':'NP15mhsc'})
driver.add_cookie({'name':'controller_l','value':'statistics'})
文件二:
test.py
from selenium import webdriver
import time,login
driver = webdriver.Chrome()
driver.get ("http://192.168.11.18:89/admins/home/login")
login = login.loginback()
login.input('teste420','EtgN1lmNHao%2bxn4sR0MGOQ%3d%3d')
driver.get ("http://192.168.11.18:89/admins/statistics/index")
driver.maximize_window()
time.sleep(2)
这样写报错: …login.input('teste420','EtgN1lmNHao%2bxn4sR0MGOQ%3d%3d') … NameError: name 'driver' is not defined
要怎么写才能成功呢?!
|
|