Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IEdriver when i am typing some text in text field every single characters enters twice #5103

Closed
AlexTesterSB opened this issue Nov 22, 2017 · 15 comments
Labels

Comments

@AlexTesterSB
Copy link

AlexTesterSB commented Nov 22, 2017

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"

@AlexTesterSB AlexTesterSB changed the title IEdriver when i am typing some text in "input" field every single characters enters twice IEdriver when i am typing some text in text field every single characters enters twice Nov 22, 2017
@snatalia34
Copy link

snatalia34 commented Nov 27, 2017

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.

@AlexTesterSB
Copy link
Author

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%

@matijalucman
Copy link

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.

@snatalia34
Copy link

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.

@jimevans
Copy link
Member

jimevans commented Dec 3, 2017

@snatalia34 That’s an indication that you’re still using native events, and moreover, you’re using the 64-bit version of the IE driver.

@snatalia34
Copy link

snatalia34 commented Dec 4, 2017

@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.

@matijalucman
Copy link

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.

@jimevans
Copy link
Member

jimevans commented Mar 4, 2018

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

@jimevans jimevans closed this as completed Mar 4, 2018
@dnkilka
Copy link

dnkilka commented Mar 11, 2018

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

@jimevans
Copy link
Member

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

@Ishmael9947
Copy link

@jimevans, crashing issue still exists in 3.12.0

@jimevans
Copy link
Member

@Ishmael9947 I’m perfectly willing to believe a crashing issue exists in 3.12. I don’t believe it to be this crashing issue. You’ll 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’m strictly limited to mobile devices until I’m able to get home.

@Ishmael9947
Copy link

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.

@jimevans
Copy link
Member

jimevans commented May 17, 2018

@Ishmael9947 The error you describe is entirely unrelated to the issue described in this issue report. Moreover, please don’t 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.

@jimevans jimevans reopened this May 17, 2018
@jimevans
Copy link
Member

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

@lock lock bot locked and limited conversation to collaborators Aug 16, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

7 participants