0

I am trying to get the ServiceNow data in to an variable with using PowerShell and Selenium Chrome Driver. But I don't know the right way to get it. I am trying to get the marked data but i can't. The below method is not working:

$Chromedriver.FindelementByTagName('input').getAttribute('value')

Could you anyone can help me ?

Snapshot:

enter image description here

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352

1 Answers1

0

Instead of FindelementByTagName you can use either of the following locator strategies:

  • Using CSS_SELECTOR:

    $Chromedriver.FindElementByCssSelector("input[aria-label='Opened']").getAttribute('value')
    
  • Using XPATH:

    $Chromedriver.FindElementByXPath("//input[@aria-label='Opened']").getAttribute('value')
    

You can find a relevant detailed discussion in Find the span text, if parent div text has certain value

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352