how to Get Text from Element
I need to get Text from the element,
can someone help me that how to get the text from the element?
Here my scenario is: I need to verify whether the column values in the table are in descending order or not.
I was tried in two different ways
1. let val1=sys.Browser("chrome").Page(pageURL).Findelements("xpath=locator").Text;
Error: Text is not a function
2. let val1 = document.querySelector("CssSelector").innerText
Error: document is undefined
Note: Here I'm trying this in Script mode
One of the most common methods to retrieve the text of an object is to the retrieve the 'contentText' of an object.
For instance, I can retrieve the text of our Login button on our SmartStore with the snippet below;
loginButtonText = Aliases.browser.Page("https://bearstore-testsite.smartbear.com/").FindElement("//span[.='Log in']").contentText;
Here is our document on the contentText Property;
I hope this helps!
Solutions Engineer @ SmartBear