我正在制作一个VBS
文件,当您打开该文件时,会在Google Chrome中启动一个标签,然后点击一个按钮。在这种情况下[PLAY]。
这是我的剧本:
Dim iURL
Dim objShell
iURL = "http://www.roblox.com/games/292439477/NEW-GUNS-Phantom-Forces-Beta"
set objShell = CreateObject("Shell.Application")
objShell.ShellExecute "chrome.exe", iURL, "", "", 1
WScript.Sleep(3000)
Document.getElementById("MultiplayerVisitButton").Click()
如果任何人都有办法让它实际点击它会很好。
答案 0 :(得分:0)
看起来好像您已将Chrome文档传递到Document对象中。
尝试添加两个引用:Microsoft Internet Controls和Microsoft HTML Object Library,然后:
Dim iURL
Dim objShell
Dim Document As HTMLDocument
Dim Elem As IHTMLElement
Dim Elements As IHTMLElementCollection
iURL = "http://www.roblox.com/games/292439477/NEW-GUNS-Phantom-Forces-Beta"
Set objShell = CreateObject("Shell.Application")
objShell.ShellExecute "chrome.exe", iURL, "", "", 1
WScript.Sleep (3000)
Document = objShell.HTMLDocument
Elements = Document.getelementsbyClassName("rbx-btn-primary-lg")
For Each Elem In Elements
If Elem.innerText = "Play" Then
Elem.Click
Exit For
End If
Next