Retrieving an XPath Text from a Web Element



  • I have a task where I need to retrieve the following text in black color highlighted in yellow. It is not within any tags and has no attribute. Once you locate a web element through the Inspect option, how do you retrieve that text? Also, what is it called when there is a text outside of a tag? enter image description here


  • QA Engineer

    This is just the innerText. If you were to use something like string innerText = _browser.FindElement(By.ClassName("test-id__field-label")).Text; the inner text (Duration) would be returned



Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2