Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/311.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 如何使用氦阅读页面上的文本?_Java_Testing_Automation_Qa_Helium - Fatal编程技术网

Java 如何使用氦阅读页面上的文本?

Java 如何使用氦阅读页面上的文本?,java,testing,automation,qa,helium,Java,Testing,Automation,Qa,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) { WebDri

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

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(),我得到一个错误“类型WebDriver的方法getValue()未定义” 谢谢你的帮助。提前谢谢

解决了这个问题

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

此命令正在读取字符串

我还尝试了以下命令'string text=TextField($(“/*[@id='ng-app']]]/div[2]/div[1]”)。getValue();'但为此,我得到了以下错误“类型API中的方法TextField(SearchRegion…)不适用于参数(API.$)”