51Testing软件测试论坛

 找回密码
 (注-册)加入51Testing

QQ登录

只需一步,快速开始

微信登录,快人一步

手机号码,快捷登录

查看: 3144|回复: 5
打印 上一主题 下一主题

[Appium] appium清空输入框出错

[复制链接]
  • TA的每日心情
    奋斗
    2017-4-1 09:18
  • 签到天数: 6 天

    连续签到: 2 天

    [LV.2]测试排长

    跳转到指定楼层
    1#
    发表于 2017-4-10 16:02:58 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
    代码如下:       Thread.sleep(5000);
                List<WebElement> inputs = ((FindsByAndroidUIAutomator) driver).findElementsByAndroidUIAutomator("new UiSelector().className("+"android.widget.EditText"+").index(1)");
                  //List<WebElement> input = driver.findElementsByClassName("android.widget.EditText");
                WebElement account = inputs.get(0);
                account.click(); //选中输入框
                ((AndroidDriver) driver).sendKeyEvent(123);//将光标移到最后           
                String txt = account.getText(); //获取字符串长度           
                for(int i=0;i<txt.length();i++){
                       
                    ((AndroidDriver) driver).sendKeyEvent(67);  
                   
                }           
            //clear(account);
            account.sendKeys("solar@delta.com");

    在 ((AndroidDriver) driver).sendKeyEvent(123);这行出错:
    org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command. (WARNING: The server did not provide any stacktrace information)


    百度了好久,都不知道问题出在哪,亲们知道吗



    分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
    收藏收藏
    回复

    使用道具 举报

  • TA的每日心情
    开心
    2018-3-30 09:35
  • 签到天数: 172 天

    连续签到: 6 天

    [LV.7]测试师长

    4#
    发表于 2017-4-13 00:00:05 | 只看该作者
    我是进来鄙视java的
    回复 支持 反对

    使用道具 举报

  • TA的每日心情

    2024-7-8 09:00
  • 签到天数: 943 天

    连续签到: 1 天

    [LV.10]测试总司令

    5#
    发表于 2017-4-13 09:45:45 | 只看该作者
    有解决的么学习一下
    回复 支持 反对

    使用道具 举报

  • TA的每日心情
    奋斗
    2017-4-1 09:18
  • 签到天数: 6 天

    连续签到: 2 天

    [LV.2]测试排长

    6#
     楼主| 发表于 2017-4-13 09:50:50 | 只看该作者
    本帖最后由 轻歌越野 于 2017-4-13 09:55 编辑

    查看日志发现是这个问题:
    info: [debug] Pushing command to appium work queue: ["pressKeyCode",{"keycode":1
    23,"metastate":null}]
    info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action"
    :"pressKeyCode","params":{"keycode":123,"metastate":null}}
    info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
    info: [debug] [BOOTSTRAP] [debug] Got command action: pressKeyCode
    info: [debug] [BOOTSTRAP] [debug] Returning result: {"status":13,"value":"Inject
    ing to another application requires INJECT_EVENTS permission"}
    info: [debug] Responding to client with error: {"status":13,"value":{"message":"
    An unknown server-side error occurred while processing the command.","origValue"
    :"Injecting to another application requires INJECT_EVENTS permission"},"sessionI
    d":"100e1428-5c8f-4d92-b761-d300c3ec1dc6"}

    然后找开发帮我获得了这个权限INJECT_EVENTS

    还是没用,依然报这个错,已经快崩溃了
    回复 支持 反对

    使用道具 举报

    本版积分规则

    关闭

    站长推荐上一条 /1 下一条

    小黑屋|手机版|Archiver|51Testing软件测试网 ( 沪ICP备05003035号 关于我们

    GMT+8, 2024-9-21 04:40 , Processed in 0.065709 second(s), 23 queries .

    Powered by Discuz! X3.2

    © 2001-2024 Comsenz Inc.

    快速回复 返回顶部 返回列表