VBScript按下打开的Internet Explorer中的按钮。 [英] VBScript to press a button in an opened Internet Explorer.

查看:85
本文介绍了VBScript按下打开的Internet Explorer中的按钮。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好。我有一个脚本打开一个网站,然后点击一个按钮。该按钮用随机URL打开一个新的Internet Explorer。每个新的Internet Explorer都有一个名为的按钮:

 id =" pagesHeaderLikeButton" 



所以我真正想要的。我的VBScript打开该页面,然后按下该按钮然后我想按下

 id =" pagesHeaderLikeButton" 

在新的Internet Explorer中。



到目前为止这是我的脚本:

设置IE = createobject(" internetexplorer.application")
strURL =" website"

Do While True
IE.navigate strURL
IE.Visible = true
Do While(IE.Busy或IE.READYSTATE<> 4)
WScript.Sleep 1000
循环
为Popupbutton中的每个按钮设置Popupbutton = IE.Document.GetElementsByClassName(" btn3")

button.click
WScript .sleep 5000
退出
objWindow.Quit
WScript.Sleep 5000
next
Loop

上面的脚本将按下按钮:"btn3"并且该按钮将打开一个新的IE窗口,其中有按钮" pagesHeaderLikeButton"我希望脚本在脚本按下"btn3"之后的脚本。按下按钮" pagesHeaderLikeButton"然后关闭该窗口。



请注意按钮" pagesHeaderLikeButton"是DIV类型按钮


< div id =" pagesHeaderLikeButton">

解决方案

div不是按钮,无法单击。我建议学习一些HTML来理解为什么不能像按钮一样按下它。


从这里开始: http:/ /www.w3schools.com/



Hello. I have a script that opens an website then it clicks a button. That button opens a new Internet Explorer with a random URL. Every new Internet Explorer will have a button called:

id="pagesHeaderLikeButton"


So what I really want. My VBScript opens that page, then it will press that button and then I want to press that

id="pagesHeaderLikeButton"

in that new Internet Explorer.

This is my script so far:

Set IE = createobject("internetexplorer.application") 
strURL = "website"

Do While True
IE.navigate strURL 
IE.Visible = true   
Do While (IE.Busy Or IE.READYSTATE <> 4)    
    WScript.Sleep 1000
Loop
    Set Popupbutton = IE.Document.GetElementsByClassName("btn3")
    for each button in Popupbutton
       button.click
       WScript.Sleep 5000
    exit for
    objWindow.Quit
    WScript.Sleep 5000
next
Loop

The above script will press the button: "btn3" and that button will open a new IE window where there is the button "pagesHeaderLikeButton" and I want that script after the script will press the "btn3" to press after few seconds the button "pagesHeaderLikeButton" and then to close that window.

Note that the button "pagesHeaderLikeButton" is a DIV type button

<div id="pagesHeaderLikeButton">

解决方案

A div is not a button and cannot be clicked. I recommend learning some HTML to understand why this cannot be pressed like a button.

Start here: http://www.w3schools.com/


这篇关于VBScript按下打开的Internet Explorer中的按钮。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆