vb.net - how to click the submit button in the webpage -


i'm working on vb.net application put textbox , button i'm using webbrowser in form. have got problem getting element id webpage. when put text in textbox , when click on form button, error: object reference not set instance of object.

here html source:

<button value="1" class="_42ft _4jy0 _11b _4jy3 _4jy1 selected" type="submit">post</button> 

here code use:

webbrowser1.document.getelementbyid("_42ft _4jy0 _11b _4jy3 _4jy1 selected").invokemember("click") 

do know how can click button in webpage have got class id?

your button has class, not id, code trying find id. change button to:

 <button value="1" id="_42ft _4jy0 _11b _4jy3 _4jy1 selected" type="submit">post</button> 

or if want class, use getelementsbyclassname(""), returns collection of buttons class. means have know if there more 1 class name. button index, so:

 var btn = document.getelementsbyclassname("_42ft _4jy0 _11b _4jy3 _4jy1 selected");  btn[0].click(); 

0 first one, 1 second , on


Comments

Popular posts from this blog

java - How to specify maven bin in eclipse maven plugin? -

single sign on - Logging into Plone site with credentials passed through HTTP -

php - Why does AJAX not process login form? -