How to read a text from a page using Helium?

626 Views Asked by At

enter image description here

I want to read the text showing in the picture and want to print that text using Helium. I tried the following code

import org.openqa.selenium.WebDriver;

//import com.heliumhq.selenium_wrappers.WebDriverWrapper;

import static com.heliumhq.API.*;


public class MainClass {

    public static void main(String[] args) {
        WebDriver ff = startFirefox("http://172.16.0.200:8001/");
        waitUntil(Text("Streams Tech, Inc.").exists);

        streamstech lg = new streamstech();
        lg.login(ff);
         if (getDriver().getValue().contains("You have not purchased any product yet. Please visit our product list to try out different products!"))
                System.out.println("You have not purchased any product yet. Please visit our product list to try out different products!");
            else
                System.out.println("Test failed :(");
        //String text = getValue("You have not purchased any product yet. Please visit our product list to try out different products!");
        killBrowser();
    }
}

But for getValue() I am getting an error "The method getValue() is undefined for the type WebDriver" Appreciate your help. Thanks in advance.

1

There are 1 best solutions below

0
On BEST ANSWER

Solved the problem

Text("My desire text").getValue(); 

This command is reading the string