Dear Users,
I am trying to run a sub that does the following:
I did everything but point 3. I can't do point three because the button does not have an ID but has a class. I tried to use a class but then I can't run the command .Click I don't know exactly why.
Here it is the code I have been using. When I run the macro I keep getting this error: Object does not support this method (this basically is telling me I can.t use the command .click with this getelement...
PS: if you know any good resource for data scrapping please share with me I would be forever grateful
CODE
Sub pullDatafromweb()
Dim IE As Object
Dim doc As HTMLDocument
'initializing the IE'
Set IE = CreateObject("InternetExplorer.Application")
'allows us to see the browser getting launched'
IE.Visible = True
'telling the object to go to the following object'
IE.Navigate "Home - ClinicalTrials.gov"
'tells the system to wait until the page is loaded before moving into the next line'
Do While IE.Busy Or IE.ReadyState <> 4
Application.Wait DateAdd("s", 1, Now)
'puts the specificed values/strings in the search boxed'
Loop
Set doc = IE.document
doc.getElementById("home-search-condition-query").Value = "GvHD"
IE.document.getElementById("home-search-other-query").Value = "MSC"
doc.getElementByTagClass("input.ct-searchButton.hp-searchButtonn").Click
End Sub
END CODE
I am trying to run a sub that does the following:
- Access this website (Home - ClinicalTrials.gov)
- Introduces some words in the boxes "Condition or disease" and "other terms"
- Clicks in the button "search"
I did everything but point 3. I can't do point three because the button does not have an ID but has a class. I tried to use a class but then I can't run the command .Click I don't know exactly why.
Here it is the code I have been using. When I run the macro I keep getting this error: Object does not support this method (this basically is telling me I can.t use the command .click with this getelement...
PS: if you know any good resource for data scrapping please share with me I would be forever grateful
CODE
Sub pullDatafromweb()
Dim IE As Object
Dim doc As HTMLDocument
'initializing the IE'
Set IE = CreateObject("InternetExplorer.Application")
'allows us to see the browser getting launched'
IE.Visible = True
'telling the object to go to the following object'
IE.Navigate "Home - ClinicalTrials.gov"
'tells the system to wait until the page is loaded before moving into the next line'
Do While IE.Busy Or IE.ReadyState <> 4
Application.Wait DateAdd("s", 1, Now)
'puts the specificed values/strings in the search boxed'
Loop
Set doc = IE.document
doc.getElementById("home-search-condition-query").Value = "GvHD"
IE.document.getElementById("home-search-other-query").Value = "MSC"
doc.getElementByTagClass("input.ct-searchButton.hp-searchButtonn").Click
End Sub
END CODE