簡體   English   中英

如何使用氦氣從頁面讀取文本?

[英]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(),我收到一條錯誤消息:“對於WebDriver類型,未定義getValue()方法”感謝您的幫助。 提前致謝。

解決了問題

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

該命令正在讀取字符串

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM