开发者

Clicking the button that is picture

开发者 https://www.devze.com 2023-03-07 15:48 出处:网络
I need help with my code. I am making program that will login to a site, then rate something 开发者_开发技巧(Bot), so on login there is no button, but picture and i used this:

I need help with my code. I am making program that will login to a site, then rate something 开发者_开发技巧(Bot), so on login there is no button, but picture and i used this:

For Each logn As HtmlElement In WebBrowser1.Document.GetElementsByTagName("input")
    If logn.OuterHtml.Contains("/images/login_button.png") Then
        logn.InvokeMember("click")
    End If
Next 

to login...

But there is another button and i have no idea how to click it... Its picture like the first button, but i can't click it with same function... Site is http://www.toneaday.com Thanks.


You'll need to call 'onclick'. See if this works.

System.Reflection.MethodInfo mi = logn.GetType().GetMethod("onclick");
mi.Invoke(logn, new object[0]); 

(it's c#, you'll need to convert it to vb.net)


If the web site accepts a keyboard submit (pressing enter on a text input on the form), you should be able to simulate that by calling the form element's submit mathod, or if there is a onsubmit event handler, by raising the onsubmit event on the form. I think that's how WatiN handles image buttons.

0

精彩评论

暂无评论...
验证码 换一张
取 消