[英]Click button in WebBrowser control vb.net
I am trying to click the button highlighted in picture below. 我想点击下图中突出显示的按钮。 The code is from a web page:
代码来自网页:
I'm not to sure, but I believe the button is within an iFrame. 我不确定,但我相信按钮是在iFrame中。
I have tried: 我努力了:
Dim wrapClick As HtmlElement = Contact.WebBrowser1.Document.GetElementById("Btn_WrapUp")
wrapClick.InvokeMember("Click")
And: 和:
Dim elPoint As New Point(704, 340)
Dim wrapClick As HtmlElement = Contact.WebBrowser1.Document.GetElementFromPoint(elPoint)
wrapClick.InvokeMember("onClick")
And: 和:
Contact.WebBrowser1.Document.GetElementById("Btn_WrapUp").InvokeMember("Click")
In all of the above, I have tried 'onClick' and 'Click'. 在上述所有内容中,我尝试过'onClick'和'Click'。
WebBrowser1 is on a different form. WebBrowser1采用不同的形式。
Thanks! 谢谢!
Click button in WebBrowser control - working example: 单击WebBrowser控件中的按钮 - 工作示例:
Main file with frame - x.html: 带框架的主文件 - x.html:
<html>
<body>
<iframe width="400" height="300" src="y.html" id="frame1"> </iframe>
</body>
</html>
File placed in frame - y.html - with submit button: 文件放在框架中 - y.html - 使用提交按钮:
<html>
<body>
<form action="...some_action...">
<input type="submit" id="btn"> Submit!
</form>
</body>
</html>
Button on VB form with OnClick event: 使用OnClick事件在VB表单上的按钮:
Dim Frame1 As HtmlWindow = WebBrowser1.Document.Window.Frames("frame1")
Frame1.Document.GetElementById("btn").InvokeMember("click")
VB2010Ex & .NET Framework 4 Client Profile. VB2010Ex和.NET Framework 4客户端配置文件。 I have tried code with action that load other site.
我已尝试使用加载其他网站的操作的代码。 Site was loaded in iframe.
网站已加载到iframe中。 Finally success :-)
最后成功:-)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.