excel - Get data from a website based on content in worksheet -
sub try() dim ie object dim myhtml_element ihtmlelement dim myurl string dim myurlser string set ie = createobject("internetexplorer.application") on error goto err_clear myurl = "[http://test.com/login][1]" set mybrowser = new internetexplorer mybrowser.silent = true mybrowser.navigate myurl mybrowser.visible = true loop until mybrowser.readystate = readystate_complete set htmldoc = mybrowser.document htmldoc.all.j_username.value = "user" 'enter email id here htmldoc.all.j_password.value = password'enter password here each myhtml_element in htmldoc.getelementsbytagname("input") if myhtml_element.type = "button" myhtml_element.click: exit next on error goto err_clear myurl = "http://test.com/home" set mybrowser = new internetexplorer mybrowser.silent = true mybrowser.navigate myurl mybrowser.visible = true err_clear: if err <> 0 err.clear resume next end if end sub
my problem when try enter number want search in website i'm unable that. unable enter submit button.
<form name=menusearchform id=menusearchform style="padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; padding-right: 0px" action=abc/search/default method=post> <input name=searchkeyword class=search-field id=search value="enter number" jquery19101740035784191712="16"> <td class=search_btn><a style="margin: 0px" onclick=javascript:submitsearch(); href="javascript:void(0);">
try running javascript directly.
call htmldoc.parentwindow.execscript("submitsearch();", "javascript")
the href
in a
element set nothing onclick
set run above script.
Comments
Post a Comment