Python脚本点击按钮
我有一段代码已经在一个游戏网站上运行很久了,但现在他们改变了点击的方式 :-
def formRaid():
#print formerID
one = 1
while one == 1:
try:
global _startTime
_startTime = datetime.datetime.now()
formpage = alo("http://"+server+".outwar.com/formraid.php?target=" + bossToRaidId+"&suid="+FORMER_ID).read()
codeID = formpage.split('codeid" value="')[1].split('">')[0]
Form = alo2("http://"+server+".outwar.com/formraid.php?target=" + bossToRaidId, "target=" + bossToRaidId + "&codeid=" + codeID + "&formtime=3&submit=Launch!").read()
global RAID_ID, RAID_NAME
RAID_ID = getRaidID(Form)
RAID_NAME = getRaidName(Form)
print ""
print "***" + RAID_NAME + " Formed."
one = 0
return True
except IndexError:
print "Forming Error, retrying...."
time.sleep(1)
现在我需要点击一个按钮才能继续,关于这个按钮的信息是 :-
<input type="submit" value="Join this Raid!" name="submit">
我该如何实现之前的点击方式 :-
formpage = alo("http://"+server+".outwar.com/formraid.php?target=" + bossToRaidId+"&suid="+FORMER_ID).read()
codeID = formpage.split('codeid" value="')[1].split('">')[0]
或者使用这个 :-
Form = alo2("http://"+server+".outwar.com/formraid.php?target=" + bossToRaidId, "target=" + bossToRaidId + "&codeid=" + codeID + "&formtime=3&submit=Launch!").read()
要点击这个按钮,而不是之前的操作??
1 个回答
0
这段代码的意思是打开一个网址,网址的格式是"http://"+服务器名+".outwar.com/formraid.php?target=" + 要攻击的boss的ID + "&suid="+以前的用户ID。这里面有几个参数,比如"formtime=3"表示表单的时间是3,"message="是消息内容,"bomb=none"表示没有炸弹,"submit=Launch!"是提交按钮的文字。
需要注意的是,这段代码只适用于Python 2.7版本。