Appium : Clear a field

后端 未结 26 3187
野趣味
野趣味 2020-12-16 16:03

I have my login screen in app now. Each time the app is launched in screen the mobile number is pre filled with the older text.

I just want to know I have tried:

26条回答
  •  一个人的身影
    2020-12-16 17:03

    For iOS, I can perform backspace/delete by using below code of snippet:

        //Get the keyword
        String name = driver.findElement(by).getText();
        WebElement e1 = driver.findElement(by);
        System.out.println("Length of Keyword = " +name.length());
        int count = 0;
        int keywordlength = name.length();
        //click on keyword textbox
        e1.click();
        while (count < keywordlength) {
            //Clear the keyword
               TouchAction ta = new TouchAction(driver);
               ta.longPress(e1);
               driver.getKeyboard().sendKeys(Keys.DELETE);
               count++;
        }
    

提交回复
热议问题