vba - Vba自动化单击此脚本中的“输入”按钮
问题描述
我一直在尝试单击 GPS Vizualizer 上的此按钮但没有成功,我尝试了几种方法,包括在设置我的暗淡等和设置到文档之后..;没有成功,我错过了什么,谁能帮忙,谢谢
With doc.all("input")
.focus
.OnClick
End With
HTML:
<input style="font-weight: bold; margin-bottom: 3px;"
onclick="this.form.action='http://www.gpsvisualizer.com/map?output_geocoder'; document.map_form.special.value='geocoder'; this.form.submit();"
type="button" value="Draw a map">
解决方案
尝试:
.document.querySelector("input[onclick*='this.form.action']")
它使用 的.querySelector
方法document
来应用一个 css 选择器,该选择器查找input
包含属性的标签onclick
,其中包含字符串'this.form.action'
您还可以使用:
doc.getElementsByTagName("input")(8).Click
以下工作:
Option Explicit
Public Sub GetInfo()
Dim IE As New InternetExplorer
With IE
.Visible = True
.navigate "http://www.gpsvisualizer.com/geocoder/"
While .Busy Or .readyState < 4: DoEvents: Wend
.document.querySelector("input[onclick*='this.form.action']").Click
' .document.getElementsByTagName("input")(8).Click
Stop '<==Delete me
.Quit
End With
End Sub
推荐阅读
- c - 使用 #ifndef 保护 .h 变量不会停止多个定义。怎么修?
- blogs - Squarespace 博客上的 Facebook 插件
- selenium-webdriver - 等待选项被填写到下拉Jmeter
- python - 是否刷新 OAuth 刷新令牌标准行为?
- tensorflow - TensorFlow 2.3:使用自定义层和模型从 ModelCheckPoint 回调加载模型
- c# - .NET Framework (4.8) 的 Cake runner 不选择环境变量
- spring - 如何在春季启动中访问战争之外的资源文件夹
- module - Rpi4 和 Ejabberd 外部注册
- javascript - 如何将对象添加为数据属性
- image - Flutter - 如何在使用 Image.Network 调用带有错误 url 的图片时捕获错误