Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is Selenium InternetExplorerDriver Webdriver very slow in debug mode (visual studio 2010 and IE9)

Tags:

I'm using the example code from the SeleniumHq site - but in debug mode the performance is awful.

In release mode the entire test takes about 6 seconds (including launching and closing IE) In Debug mode it takes 65 seconds ?

The sample code is just :

    [Test]
    public void testBrowser()
    {
        // Do something here
        IWebDriver driver = new InternetExplorerDriver();
        //Notice navigation is slightly different than the Java version
        //This is because 'get' is a keyword in C#
        driver.Navigate().GoToUrl("http://www.google.com");
        IWebElement query = driver.FindElement(By.Name("q"));
        query.SendKeys("Cheese");
        System.Console.WriteLine("Page title is: " + driver.Title);
        // TODO add wait
        driver.Quit();

    }

I've tried it in ie8 and have the same performance. Firefox is fine - but my clients use IE so I'm stuck with testing against it. Also - I don't have the same issues if I use Selenium RC.

NB - I'm using .Net 4 and the latest version (2.16) of the webDriver.dll (running on a 64bit windows 7 box)

like image 432
Jon Spokes Avatar asked Jan 13 '12 11:01

Jon Spokes


People also ask

Why is selenium WebDriver so slow?

Generally, Selenium WebDriver scripts are very slow because they run through the browser. There are multiple ways that help to increase their speed. They are as follows: 1)Use Fast selectors.

How can I make Selenium faster?

Parallel Testing in Selenium Automation It is one of the easiest ways to expedite the Selenium test cases. Parallel testing allows you to execute multiple tests simultaneously on different device-browser combinations and OS configurations, covering the entire test suite in no time.

How do I run a selenium script in debug mode?

Running The Code In Debug Mode Now the breakpoint has been set, we can run the code in debug mode. This can be done in 2 ways as given below: #1) Right-click the Java class and select Debug As => Java Application. #2) Select the Debug Icon (There is a bug like icon on the toolbar).

Why is Selenium Automation slow on IE?

Because so much of this functionality is built in JavaScript, a browser that has a slow JavaScript engine like IE Will show poor performance when executing WebDriver code.


2 Answers

For me, the fix was to switch to the 32 bit version of InternetExplorerDriver.exe from https://code.google.com/p/selenium/downloads/list

Seemingly named IEDriverServer nowadays, but works if you just rename it to InternetExplorerDriver.exe.

like image 61
slavikko Avatar answered Sep 18 '22 00:09

slavikko


check 'prefer 32 bit' is not checked in your build properties. If it is and you are using the 64 bit IE driver it will run like an asthmatic snail.

like image 29
Jules Avatar answered Sep 21 '22 00:09

Jules