使用 Calablash 在 Dropbox 登录 Web 视图中输入用户名和密码 android

Enter username and password into Dropbox login webview with Calablash android

我正在创建一个预期会在保管箱中登录的测试。因此,该应用程序启动了 Dropbox 登录 Web 视图。 使用 query("webView css:'input'") 我可以检索两个输入:登录名和密码。

当我尝试使用 enter_text(query("webView css:'input'").first,"email@gmail.com") 设置电子邮件字段时,出现错误:

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

知道如何解决这个问题吗?谢谢!

我已经设法设置了文本,它可以工作,但我不明白问题的命令有什么区别。 解决方案是:enter_text("webView css:'input[name=login_email]'", "email@gmail.com")

可能 enter_textquery 合不来

我建议您尝试使用 xpath 在 enter_text 函数的第一个参数中限制您的查询过滤器:

enter_text("webView xpath:'//input[@id=\"pyxl14\"]'", "email@gmail.com")