Selenium WebDriver sendkeys method sometimes type incorrect value to text area of input field, if value that typing contains forward slash (/) character. For examlple

element located in:

<input id="dp1416998181403" class="single-value hasDatepicker" type="text" maxlength="10" value="12/31/2010" style="width: 67px;">

code

String a = "12/31/2014"
driver.findElement(By.id("dp1416998181403")).sendKeys(a);

in some case actual value that typed is equals: 31/2014 instead of 12/31/2014 or 2014 instead of 12/31/2014 This problem isn't reproduce always I noticed, in some case, Selenium type first 3 character (12/), then delete them and type rest of character (31/2014)

Has anybody have the same problem? I found a problem with typing a /, but problem was that / changing to 7 when typing

1

There are 1 best solutions below

4
On

@user3293822 :

Not Really But can you try to add explicit wait before you send keys , Here is an example of what you can do..I am sure you will not find any data loss during execution.

String a = "12/31/2014";
WebDriverWait  Test_element = new WebDriverWait(driver, 10);
Test_element.until(ExpectedConditions.elementToBeClickable(By.id("dp1416998181403"))).sendKeys(a);

Try the above and let me know what happens