Selenium: IEdriver when i am typing some text in text field every single characters enters twice

Created on 22 Nov 2017  路  15Comments  路  Source: SeleniumHQ/selenium

OS:
Windows 10
Selenium Version:
3.7.0, IDE - visual studio, programming language - c#

Browser:
Internet Explorer 11
Browser Version:
11.726.15063.0 (64-bit)

Expected Behavior - when I type some text (for example: "some text") it should be entered exactly as it was in code ("some text").
Actual Behavior - when I type some text (for example: "some text") every single charachter from it enters twice, (so result is like this "ssoommee tteexxtt").

Steps to reproduce -
here is the code (c#) which shall reproduce it:

using NUnit.Framework;
using Autotests.Selenium.TestModel.PageDeclarations.Inbox;
using System.Threading;
using Selenium.Core.WebDriver;
using System;
using Autotests.Selenium.TestModel;
using OpenQA.Selenium;
using OpenQA.Selenium.IE;
[Test]
public void TestTypingTextByIE()
{
var service = InternetExplorerDriverService.CreateDefaultService();
var IeOptions = new InternetExplorerOptions();
IeOptions.PageLoadStrategy = PageLoadStrategy.None;
IeOptions.IntroduceInstabilityByIgnoringProtectedModeSettings = true;
IeOptions.EnablePersistentHover = true;
IeOptions.EnableNativeEvents = false;
IeOptions.EnsureCleanSession = true;
IeOptions.RequireWindowFocus = true;
IeOptions.IgnoreZoomLevel = true;
IeOptions.FileUploadDialogTimeout = new TimeSpan(0, 0, 30);
var driverIe = new InternetExplorerDriver(service, IeOptions);
driverIe.Manage().Window.Maximize();
driverIe.Navigate().GoToUrl("https://devform.socialboards.com/demo");
Thread.Sleep(10000);
driverIe.FindElement(By.XPath("//textarea[@name='message']")).SendKeys("123412341234");
}
);

But as I could understand, the whole problem is in this option "EnableNativeEvents = false"

D-IE

All 15 comments

I experience the same issue with following setup:
Win 7 64bit , IE 11, selenium 3.7.1, IEDriverServer.exe 3.7.0 64bit
EnableNativeEvents = false

Looks like adding capability RequireWindowFocus = true solves the issue.

Below I'll write options which allow to avoid this bug:
IeOptions.EnablePersistentHover = true;
IeOptions.EnableNativeEvents = true;

Another important thing - to set up IE11 zoom with 100%

Issue still exists if nativeEvents are turned off. This is simple reproducible script which demonstrates problem:

        InternetExplorerOptions options = new InternetExplorerOptions();
        JSONObject jsonCapabilities = new JSONObject();

        jsonCapabilities.put("nativeEvents", false);
        options.setCapability("se:ieOptions", jsonCapabilities);

        WebDriver driver = new InternetExplorerDriver(options);
        WebDriverWait wait = new WebDriverWait(driver, 10);

        driver.get("https://www.google.hr/");

        WebElement input = wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("lst-ib")));

        input.sendKeys("Selenium");

        driver.quit();

Script is tested with IEDriverServer 3.7.0. and Selenium 3.8.0.
This issue exists from IEDriverServer 3.5.1. so we are forced to use 3.4.0. version because of this.

I am not able to reproduce the issue with IEDriverServer 3.8.0. and Selenium 3.8.1 anymore (nativeEvents are turned off). Although, typing is very slow now: every character takes about 5 seconds to be entered.

@snatalia34 That鈥檚 an indication that you鈥檙e still using native events, and moreover, you鈥檙e using the 64-bit version of the IE driver.

@jimevans
I have explicitly set EnableNativeEvents to false in my script.
The same script types characters differently depending on setup:

IE driver 3.7 64bit + grid 3.7: each character entered twice
IE driver 3.8 64bit + grid 3.8.1: slow typing, each character entered once
IE driver 3.7 32bit + grid 3.7: each character entered twice
IE driver 3.8 32bit + grid 3.8.1: quick typing, each character entered once
Tested on WIN10.
Thank you for the hint to use 32bit version.

It works with IE driver 3.8 32bit + grid 3.8.1 configuration because native events are turned on.
It seems like desired capabilities for IEDriverServer are ignored when Selenium Standalone Server version 3.8.1. is used.

This should be fixed in e0b5478, released as part of 3.10.

The "fix" now causes IE driver to crash when native events are off.

@dnkilka, have you tried 3.11? The crash should be fixed in that release.

@jimevans, crashing issue still exists in 3.12.0

@Ishmael9947 I鈥檓 perfectly willing to believe _a_ crashing issue exists in 3.12. I don鈥檛 believe it to be _this_ crashing issue. You鈥檒l need to supply some WebDriver code that exhibits your particular crash.

Also, please be aware that I have no access to a laptop to investigate the issue for the next few days. I鈥檓 strictly limited to mobile devices until I鈥檓 able to get home.

No problem - thanks!

Windows 7 Pro SP1
IE 11

Code is as follows:
string IE_DRIVER_PATH = @"C:\Selenium";
string URL = @"http://www.google.com";

        InternetExplorerOptions caps = new InternetExplorerOptions();
        caps.EnableNativeEvents = false;
        caps.IntroduceInstabilityByIgnoringProtectedModeSettings = true;
        InternetExplorerDriver driver = new InternetExplorerDriver(IE_DRIVER_PATH, caps);

        driver.Manage().Window.Maximize();
        driver.Navigate().GoToUrl(URL);
        driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(30);
        driver.FindElementByXPath("//*[@name='q']").Click();
        driver.Keyboard.SendKeys("tst");

Stack trace:
{"Object reference not set to an instance of an object."}
at OpenQA.Selenium.Remote.HttpCommandExecutor.HttpRequestInfo..ctor(Uri serverUri, Command commandToExecute, CommandInfo commandInfo)
at OpenQA.Selenium.Remote.HttpCommandExecutor.Execute(Command commandToExecute)
at OpenQA.Selenium.Remote.DriverServiceCommandExecutor.Execute(Command commandToExecute)
at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
at OpenQA.Selenium.Remote.RemoteKeyboard.SendKeys(String keySequence)
at ConsoleApplication4.Program.Main(String[] args) in c:\users\ishmael9947\documents\visual studio 2015\Projects\ConsoleApplication4\ConsoleApplication4\Program.cs:line 30
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()

Note: it doesn't matter whether the driver capabilities are set to true or false or not set - I get the crash no matter what.
I stepped through this and I can click all over the screen but as soon as it tries the sendkeys that's when I get the crash.

@Ishmael9947 The error you describe is entirely unrelated to the issue described in this issue report. Moreover, please don鈥檛 use the Keyboard or Mouse properties. Those will not work with W3C-compliant WebDriver implementations like the IE driver. You can use the SendKeys method of the IWebElement object returned by the FindElement method, or can use the Actions class.

Inadvertently reopened this issue due to commenting on it using a mobile device from my hospital room. Reclosing.

Was this page helpful?
0 / 5 - 0 ratings