So I am using VBA for Webscrapping. In my first TAB I am populating areas and then clicking Submit. This generates a new tab with an element that I need to click to export the data that I need. The problem is when I try to reference that new element ID , I get a few errors.
I know one solution would be to reference the new tab URL but I don't know what that URL will be until it opens. + the parameters do not show in the URL.
Here is code:
Sub SearchBot()
Dim objIE As InternetExplorerMedium 'special object variable representing the IE browser
Dim aEle As HTMLLinkElement 'special object variable for an <a> (link) element
Dim objIE_1 As InternetExplorerMedium
Set objIE = New InternetExplorerMedium
objIE.Visible = True
objIE.navigate "http..."
'wait here a few seconds while the browser is busy
Do While objIE.Busy = True Or objIE.readyState <> 4: DoEvents: Loop
objIE.document.getElementById("chkSalesOrder").Click
objIE.document.getElementById("chkWO").Click
objIE.document.getElementById("chkWOPartNumber").Click
objIE.document.getElementById("chkOperation").Click
objIE.document.getElementById("Submit1").Click
****NOW New tab opens with the populated search
and I am not sure how to move forward
I am not sure how to declare my new object for my new tab. any help would be appreciated
Aucun commentaire:
Enregistrer un commentaire