简体   繁体   中英

Powershell to get the web element value info as a variable

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:

在此处输入图像描述

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM