2016-06-14 135 views
2

我正在創建一個測試,希望在Dropbox中登錄。因此,該應用程序啓動Dropbox登錄webview。 與query("webView css:'input'")我可以檢索兩個輸入:登錄名和密碼。輸入用戶名和密碼到Dropbox用Calablash登錄webview android

當我嘗試設置電子郵件字段enter_text(query("webView css:'input'").first,"[email protected]")我得到的錯誤:

RuntimeError: map {"class"=>"text-input-input autofocus", "nodeType"=>"ELEMENT_NODE", "id"=>"pyxl14", "calSavedIndex"=>5, "html"=>"<input class=\"text-input-input autofocus\" type=\"email\" name=\"login_email\" id=\"pyxl14\">", "textContent"=>"", "rect"=>{"y"=>640, "x"=>52, "center_x"=>540, "height"=>89, "width"=>976, "top"=>220, "left"=>20, "center_y"=>685}, "nodeName"=>"INPUT", "webView"=>"NoResourceEntry-6"}, query failed because: java.util.LinkedHashMap cannot be cast to java.lang.String

不知道如何解決這個問題?謝謝!

+0

有你檢查它是不是cordovaWebView?在葫蘆控制檯中運行'query「*」'並嘗試在輸出中找到根webview元素類型。 –

+0

@RogérioPeixoto其實我都有。 Dropbox一個是WebView。無論如何,我能夠獲得輸入字段,所以這不是問題,問題是我無法設置文本。 – gderaco

回答

1

我已經設置了文本,它的工作原理,但我不明白與問題的命令有什麼不同。 解決的辦法是:enter_text("webView css:'input[name=login_email]'", "[email protected]")

大概enter_textquery沿

0

沒有得到我會建議您嘗試使用XPath限制查詢過濾器在enter_text函數的第一個參數:

enter_text("webView xpath:'//input[@id=\"pyxl14\"]'", "[email protected]") 
相關問題