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.$)”