VBA Selenium Scraping text from label


How do I extract the following "label" using the chrome driver in Selenium for VBA? The information that I want is "Character 3"


<label for="frmentermemorableinformation1:strEnterMemorableInformation_memInfo1">Character 3 &nbsp;</label>


To print the text Character 3 you can use either of the following locator strategies:

  • Using css_selector:

    Debug.Print .FindElementByCss("label[for^='frmentermemorableinformation1'][for$='strEnterMemorableInformation_memInfo1']").Text
  • Using xpath:

    Debug.Print .FindElementByXPath("//label[starts-with(@for, 'frmentermemorableinformation1') and contains(@for, 'strEnterMemorableInformation_memInfo1')]").Text

Answered By – undetected Selenium

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published