使用Python中的Spynner填写表单
我正在尝试在这个网站上填写我的用户名和密码:https://www.imleagues.com/Login.aspx
然后我想提交这些信息并登录。我已经能够点击登录按钮,但系统告诉我我的用户名和密码不正确。我该如何填写这些信息呢?我以为我用这个方法可以做到:
URL = 'https://www.imleagues.com/Login.aspx'
address = "http://www.imleagues.com/School/Team/Home.aspx?Team=27d6c31187314397b00293fb0cfbc79a"
b = spynner.Browser()
b.show()
b.load(URL)
b.wk_fill('input[name=ctl00$ContentPlaceHolder1$inUserName]', '******')
b.wk_fill('input[name=ctl00$ContentPlaceHolder1$inPassword]', '******')
但显然这样不行。谢谢大家的帮助。
1 个回答
0
这个对我有效:
import spynner
URL = 'https://www.imleagues.com/Login.aspx'
address = "http://www.imleagues.com/School/Team/Home.aspx?Team=27d6c31187314397b00293fb0cfbc79a"
b = spynner.Browser()
b.show()
b.load(URL)
b.runjs('$("#ctl00_ContentPlaceHolder1_inUserName").val("testUser")')
b.runjs('$("#ctl00_ContentPlaceHolder1_inPassword").val("testPass")')