如何使用 Helium 从页面中读取文本?

How to read a text from a page using Helium?

我想阅读图片中显示的文字,并想使用 Helium 打印该文字。我尝试了以下代码

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();
    }
}

但是对于 getValue() 我收到一个错误 "The method getValue() is undefined for the type WebDriver" 感谢你的帮助。提前致谢。

解决了问题

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

此命令正在读取字符串