自动按钮点击(谷歌搜索答案不起作用) [英] automate button click(googled answers not working)
问题描述
大家好,
我正在尝试自动化并让浏览器点击一个按钮但是它无法正常工作
我googled。并找到这些链接
在MSDN中讨论
Stackover流程
和许多其他
i想要自动化三星网站。
首先选择一个类别(冰箱,洗衣机等......)
,然后转到SEE ALL
点击该类别在按钮查看全部并获取产品列表
MSDN建议的对象调用很少工作。 (比如十分之一)
任何其他建议请
但是没有一个工作
hi all,
I am trying to automate and get the browser to click a button but it is not working
i googled. and found these links
Talk in MSDN
Stackover flow
and many other
i want to automate Samsung website.
first select a category(Refrigerator, washer, etc...)
in that go to "SEE ALL"
in that category click on the button "VIEW ALL" and get the product list
the MSDN suggestion of object invoke is working rarely. (like 1 in 10 times)
any other suggestion please
but none of them work
推荐答案
I一些如何使这个工作...不确定是否有一个正确的解决方案或更好的我使用这个
I some how got this to work... not sure if there is a correct solution or more good one i used this
Dim el As HtmlElement = Me.webBrowser1.Document.All("Button1")
Dim obj As Object = el.DomElement
Dim mi As System.Reflection.MethodInfo = obj.[GetType]().GetMethod("click")
threading.thread.sleep(2000)
mi.Invoke(obj, New Object(-1) {})
需要睡眠我不知道原因。但是,如果你等待它正在工作。
希望这会运作足够长的时间。
如果有更好的解决方案,请告诉我
谢谢
And the sleep is needed i am not sure of the reason. but if you put a wait it is working.
hope this will work long enough.
please let me know if there is a better solution to do it
Thanks
这篇关于自动按钮点击(谷歌搜索答案不起作用)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!