I am facing an issue while using the sendKeys() method within some tests. It seems like Selenium is not able to type the whole string but partially ignores numbers that are non-zero.
Examples:
Input 5.0 Output: .0
Input 5 Output: (blank)
Input 55.0 Output: .0
Input 550.0 Output: 0.0
I have other pages that are being tested, with both similar and different input fields. All of them work without any issue. The input fields that are showing this issue are of type="text"
.
I would safely assume it's not a ChromeDriver issue, as other identical fields in different pages work without this issue. The project is using Java 8 so I updated to the latest possible version of Selenium which is 4.13.0. The ChromeDriver version that I am using is 118.0.5993.70. I am testing this web interface in a Linux environment in a Azure instance (connected through RealVNC).
Edit:
As requested, this is the method I am using to change the input fields. The method is called through a JBehave story.
public void setValue(String value) {
if(selectedField.getTagName().equalsIgnoreCase("input")) {
selectedField.clear();
selectedField.sendKeys(value);
}
else if(selectedField.getTagName().equalsIgnoreCase("select")) {
this.setCombo(value);
}
else throw new AssertionError("Trying to assign value to an unrecognized field type");
}
The variable selectedField is a WebElement, correctly selected in the steps before.
private WebElement selectedField;
And the following one is the input field that I'm trying to modify:
<input id="scheduleRun:elipsu" type="text" name="scheduleRun:elipsu" value="10.0" size="5" title="Size of the screening volume in the radial direction of the OCRF reference frame of the target">
After debugging, I discovered that the problem is related to the Chrome WebDriver when Chrome is being started by Selenium. The problem therefore is not related to the Java code, or Selenium.
The issue is with just with number "5" acting as a backspace instead of the actual number "5" when Chrome is controlled by an automated test software. The same version of Chrome started manually will not display the issue. This issue is unrelated to the website tested.
I will post another question related to the Chrome WebDriver