1

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

HTML:

<label for="frmentermemorableinformation1:strEnterMemorableInformation_memInfo1">Character 3 &nbsp;</label>
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
Vik
  • 469
  • 2
  • 6
  • 18

1 Answers1

2

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
    
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352