How would I program my bot to clear away placeholder writing?

杀马特。学长 韩版系。学妹 提交于 2019-12-11 14:58:32

问题


I'm making a bot to log in to bing.com using plain old windows notepad, and so far, I have this:

set wb = createobject("internetexplorer.application")
wb.statusbar = false
wb.menubar = false
wb.toolbar = false
wb.visible = true

wb.navigate("https://login.live.com/login.srf?wa=wsignin1.0&rpsnv=13&ct=1511575188&rver=6.7.6631.0&wp=MBI&wreply=https%3a%2f%2fwww.bing.com%2fsecure%2fPassport.aspx%3frequrl%3dhttps%253a%252f%252fwww.bing.com%252f%253fwlexpsignin%253d1&lc=1033&id=264960&CSRFToken=3f67b462-bf5b-4492-9925-e583298a3350&aadredir=1")

wscript.sleep(5000)

wb.document.all.item("i0116").value = "asdf1234@gmail.com"

wscript.sleep(100)

But, when the line that is supposed to type in my email "asdf1234@gmail.com" runs, a jumbled mess of stuff appears.

Originally, there are words in the box like "Email, phone number, or Skype" and you're supposed to click on it and type your email. But, when my bot does it, my email and the "placeholder text" mash together and produce random characters that are really weird.

I tried finding the id for the placeholder text so I can manipulate it by looking in inspect element, but I can't seem to do anything.

I'm really new to bot writing, and if anybody could help, I would greatly appreciate it. Thanks in advance!


回答1:


Add this line to hide the hint text

wb.document.getElementsByClassName("phholder")(0).style.display = "none"

May I also suggest replacing wscript.sleep(5000) with

Do While true
    if wb.readystate = 4 then exit do
    wscript.sleep(100)
Loop

Which should just wait until the page is loaded.



来源:https://stackoverflow.com/questions/47482057/how-would-i-program-my-bot-to-clear-away-placeholder-writing

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!