Extract the value of a WebElement
If you obtain an object from a Web page or a mobile application that contains a value you want to extract, you can use the WebElement
getText()
method, as shown in the following example.
Copy
WebElement element = driver.findElementByXPath("//android.widget.TextView[../@content-desc='Driving mode']"); //Modify the xpath according to your wishes
// To obtain the driving time value from the found element:
String drivingTime = element.getText();