Selenium WebDriver typing very slow in text field on Internet Explorer

Guys, In this Post I would like to talk about the slow typing issue that you might have faced in IE browser.

As we use sendkeys command to type in text field, however this command sometime doesn’t work as expected on IE browser. Example, if you want to type let say “Test Selenium” in any text field, then it types First “T” and then waits for 1-2 seconds before typing next character.

If you are facing the above issue on IE Browser, then you are at right place. Below is the solution to overcome from the above issue :

Follow below steps :

1) Use IE Driver Server of 32 bit instead of 64 bit

2) Set native events to false in your desired capability while intializing Internet explorer driver object

DesiredCapabilities capabilities = new DesiredCapabilities();
ieOptions.setCapability(InternetExplorerDriver.NATIVE_EVENTS, false);
driver = new InternetExplorerDriver(capabilities);

You can also use InternetExplorerOptions class to set capabilities for driver object

InternetExplorerOptions ieOptions = new InternetExplorerOptions();
ieOptions.setCapability(InternetExplorerDriver.NATIVE_EVENTS, false);
driver = new InternetExplorerDriver(ieOptions);

NOTE : Above 2 steps has solved slow typing issue on IE browser for me. Please test at your end and let me know in comment section, if above solution is not working for anyone.

Complete Example

import java.util.concurrent.TimeUnit;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;
import org.openqa.selenium.ie.InternetExplorerOptions;
import org.testng.annotations.Test;

public class SampleTest {

	@Test
	public void test_01() {
		System.setProperty("webdriver.ie.driver",
				System.getProperty("user.dir") + "/IEDriverServer.exe");
		InternetExplorerOptions ieOptions = new InternetExplorerOptions();
		ieOptions.setCapability(InternetExplorerDriver.NATIVE_EVENTS, false);
		WebDriver driver = new InternetExplorerDriver(ieOptions);
		driver.manage().timeouts().implicitlyWait(50, TimeUnit.SECONDS);
		driver.get("http://www.google.com");
		driver.findElement(By.name("q")).sendKeys("Test Selenium");
	}

}

If you really like the information provided above, please don’t forget to like us on Facebook, you can also leave the comment.

Leave a Reply

Your email address will not be published. Required fields are marked *


Notice: Undefined offset: 0 in G:\PleskVhosts\automate-apps.com\httpdocs\wp-content\plugins\cardoza-facebook-like-box\cardoza_facebook_like_box.php on line 924