SendKeys in 3.5.2 sends incorrect keys when using grid and RemoteWebDriver
The following example using 3.5.2 libraries shows different behaviour if using a local or a RemoteWebDriver. If using a local driver (in the example ChromeDriver.exe but the same behaviour is shown with IEDriverServer.exe) the SendKeys of Ctrl-a and backspace selects a text if present and deletes it, then sends the text "Cheese". If using a grid configuration with selenium-server-standalone-3.5.2.jar the SendKeys of Ctrl-a and backspace results in the text "?a??" being sent. If a grid configuration using selenium-server-standalone-3.4.0.jar is used instead then correct behaviour is shown by SendKeys.
package com.mytest.selenium;
import java.net.MalformedURLException; import java.net.URL;
import org.openqa.selenium.By; import org.openqa.selenium.Keys; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.remote.DesiredCapabilities; import org.openqa.selenium.remote.RemoteWebDriver;
public class SendKeyTest {
private static final boolean USELOCAL = true;
public static void main(String[] args) {
WebDriver driver = null;
if (USELOCAL) {
driver = new ChromeDriver(DesiredCapabilities.chrome());
} else {
URL url = null;
try {
url = new URL("http://localhost:4444/wd/hub");
} catch (MalformedURLException e) {
e.printStackTrace();
}
driver = new RemoteWebDriver(url, DesiredCapabilities.chrome());
}
driver.get("http://www.google.com");
WebElement element = driver.findElement(By.name("q"));
element.sendKeys(Keys.chord(Keys.CONTROL, "a")); // results in ?a? if using remote
element.sendKeys(Keys.BACK_SPACE); // results in ? if using remote
element.sendKeys("Cheese");
element.submit();
driver.quit();
System.out.println("done");
}
}
Duplicate of #4462