VBA MACRO Button click using a class instead of ID

  • Dear Users,

    I am trying to run a sub that does the following:

    1. Access this website (https://clinicaltrials.gov/)
    2. Introduces some words in the boxes "Condition or disease" and "other terms"
    3. 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


  • Your post does not comply with our Forum RULES. Use code tags around code.

    Posting code between Code tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the </> icon at the top of your post window.

    (I have added them for you today. Please take a few minutes to read all Forum Rules and comply in the future.)

  • Your post does not comply with our Forum RULES. Do not cross-post your question on multiple forums without telling us about your threads on other forums.

    Post a link to any other forums where you have asked the same question.

    Cross-posting is when you post the same question in other forums on the web. The last thing you want to do is waste people's time working on an issue you have already resolved elsewhere. We prefer that you not cross-post at all, but if you do (and it's unlikely to go unnoticed), you MUST provide a link (copy the url from the address bar in your browser) to the cross-post.

    Go to https://www.excelguru.ca/content.php?184 to understand why we ask you to do this.

    Please comply with this and all our rules in the future. Ingo has provided it today. If there are other sites, please add them to your post now.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!