Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in DevOps and Agile by (19.7k points)

I'm running one of my scripts on  the IE 11  browser with Selenium 2.43.1  when the script types in the text field using the following: 

element.sendKeys("string");

In the IE browser, I can see that one character of the string is typed in the text field and it waits for 1-2 seconds before typing the next character. Means for typing one character it's taking 1-2 seconds.

  1. Why is typing so slow with IE?
  2. Is there any alternate way to speed up typing?

1 Answer

0 votes
by (62.9k points)

Follow the 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 initializing 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);

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");

    }

Hope this helps! 

If you are interested to learn Selenium on a much deeper level and want to become a professional in the testing domain, check out Intellipaat’s automation testing certification!

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...