Friday, 13 July 2018

The Ways to Clear Input Box


  1. //方法1
  2. public static void setElementValue(WebElement element,String value){
  3. element.sendKeys(Keys.chord(Keys.CONTROL, "a"), value);//method1
  4. }
  5. //方法2
  6. public static void setElementValue(WebElement element,String value){
  7. element.sendKeys(Keys.HOME,Keys.chord(Keys.SHIFT,Keys.END),value);//method2
  8. }
  9. //方法3
  10. public static void setElementValue(WebElement element,String value){
  11. element.sendKeys(Keys.CONTROL + "a");//method3
  12. element.sendKeys(value);//method3
  13. }
  14. //方法4
  15. public static void setElementValue(WebElement element,String value){
  16. element.click();
  17. element.clear();
  18. element.sendKeys(Keys.BACK_SPACE );
  19. element.sendKeys(Keys.chord(Keys.CONTROL, "a"));
  20. element.sendKeys(Keys.DELETE);
  21. element.sendKeys(value);
  22. element.click();
  23. }

1 comment:

  1. 主要用来进行那种时间选项弹出框选择的清空

    ReplyDelete

What to do to make sure HTML Table is loaded completely if implicit and explicit wait are not working.

These days I was working on a project, to implement the delete function of a listing. Such as below: Actually,  every time deleted the it...