Selenium Webdriver: Entering text into text field

前端 未结 4 1732
遇见更好的自我
遇见更好的自我 2020-12-03 16:45

When I enter text into the text field it gets removed.

Here is the code:

String barcode=\"0000000047166\";

WebElement element_enter = _driver.findEl         


        
4条回答
  •  臣服心动
    2020-12-03 17:24

    It might be the JavaScript check for some valid condition.
    Two things you can perform a/c to your requirements:

    1. either check for the valid string-input in the text-box.
    2. or set a loop against that text box to enter the value until you post the form/request.
    String barcode="0000000047166";
    
    WebElement strLocator = driver.findElement(By.xpath("//*[@id='div-barcode']"));
    strLocator.sendKeys(barcode);
    

提交回复
热议问题