2

在此处输入图像描述

我想阅读图片中显示的文本,并想使用 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(),我收到一个错误“WebDriver 类型的方法 getValue() 未定义”感谢您的帮助。提前致谢。

4

1 回答 1

0

解决了问题

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

此命令正在读取字符串

于 2015-06-01T06:24:17.030 回答