How to speed up IE tests?

2,472 views
Skip to first unread message

sirus tula

unread,
Oct 16, 2012, 7:03:13 PM10/16/12
to seleniu...@googlegroups.com
Usually, I do most of the testing stuff in Firefox and Chrome. Today, I try to do in IE for cross-browser testing.
 
Based on my testing, IE is very slow compared to firefox and chrome. While it takes firefox and chrome to fill the form with probably 20 elements in 10 secs, IE takes about 1 minute and sometimes more.
 
Is there anyway we could speed up IE?
 
Selenium server: selenium-server-standalone-2.24.1.jar
IE server: 2.25.3
 
Here's my browser config file for IE driver.
 
 
public IWebDriver StartBrowser()
{
Properties.WebBrowser = "iexplore";
 
switch (Properties.WebBrowser)
   {
case "firefox":
capabilities = DesiredCapabilities.Firefox();
_driver = new RemoteWebDriver(capabilities);
break;
case "iexplore":
_driver = new InternetExplorerDriver();
break;
case "chrome":
_driver = new ChromeDriver();
break;
  }
  return _driver;
 }
}
 
 
Thanks, any help would be appreciated.
--
 
 
- "If you haven't suffered, you haven't lived your life."
 
Thanks,
 
Sirus
 

sirus tula

unread,
Oct 17, 2012, 9:34:28 AM10/17/12
to seleniu...@googlegroups.com
Isn't there ANY methods/ways to speed up IE driver other than to wait for next version of IE driver?
 
Thanks
Thanks,
 
Sirus

Gaurang shah

unread,
Oct 17, 2012, 9:46:41 AM10/17/12
to seleniu...@googlegroups.com
If you are using Xpath in your script change it to CSS selector and then check. it will definitely speed up the. 

Gaurang Shah

sirus tula

unread,
Oct 17, 2012, 9:51:10 AM10/17/12
to seleniu...@googlegroups.com
Thank you Gaurang for yoru response.
 
Yes, I am using CSS as I'm big fan of it as i hate using typing too many words for xpath lol.
 
 
The only place I use Xpath is when I try to find the text which I think Xpaths beats to CSS.
 
 
Any other suggestions other than that?
 


 

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To post to this group, send email to seleniu...@googlegroups.com.
To unsubscribe from this group, send email to selenium-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/selenium-users/-/Fz0BrnKCtUoJ.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Jim Evans

unread,
Oct 17, 2012, 10:11:29 AM10/17/12
to seleniu...@googlegroups.com
I sent a reply earlier, but it must've gotten lost in the aether. The IE driver is slow compared to Firefox and Chrome, and you would do well to Get used to that. There could be a number of reasons for the Performance issues in your particular code, but there are also architectural issues as well. Understanding those architectural issues requires a little understanding of the internals of WebDriver itself.

Much of the functionality of WebDriver is implemented using so-called "automation atoms". These are JavaScript functions that are used to ensure consistency and reduce maintenance across the different drivers. Some of these functions are fairly straightforward, and delegate down to the browsers' native code fairly quickly. Finding an element by ID, for example, pretty clearly translates to document.getElementById().

Other operations, on the other hand, are much more computationally expensive. For example, getting the text of an element is one of the most expensive things you can do, Because of the way the WebDriver API defines getting an elements text.

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. Remember that the JavaScript engine in IE before version 9 was about ten times slower than the JavaScript engines in Firefox and Chrome. IE9 introduced a new JavaScript engine that was a lot closer in performance to that of Firefox and Chrome, but Microsoft only implemented the new JavaScript engine in the 32-bit version of IE. So the first thing you can do is run your tests against the 32-bit version of IE9.

IE also doesn't have a native XPath engine for finding elements. So to be able to find elements by XPath in IE, we have to use a JavaScript XPath query engine. That's going to be slower than doing the same thing in other browsers. This is the biggest reason why I recommend using CSS selectors instead of XPath for finding elements.

I would also recommend calling expensive methods as seldom as possible. The two most expensive methods are getText() and isDisplayed(), because they have to walk a substantial portion of the DOM tree before they can return the correct value.

--Jim

Gaurang shah

unread,
Oct 17, 2012, 11:12:39 AM10/17/12
to seleniu...@googlegroups.com
Hi Jim, 

May be I am wrong. but I guess this was the case with selenium RC, right and not with the webdriver ??? Selenium RC was working using JavaScript to automate the application. And that was the reason it was have same origin policy issue and sluggish performance in IE issue. 

I don't know much about the WebDriver but what I have read and heard is that it is using Native API of particular browser to automate the application rather than JavaScript  like plug-in for Firefox and DOM component for IE and EXE for chrome.

After reading your post I am bit confuse,  coz as you say if it is using JavaScript to automate the application why not all the browsers are supported, as being supported by selenium RC. 

Gaurang Shah

Jim Evans

unread,
Oct 17, 2012, 11:42:36 AM10/17/12
to seleniu...@googlegroups.com
Let me try to clear up the confusion, if I can. There are some things, like interacting with an element, clicking, sending keystrokes, and so on; handling frames or iframes; handling alerts; and dealing with popup browser windows that are impacted by the JavaScript sandbox. In WebDriver, these operations are done by and large using mechanisms outside JavaScript, and it's these operations where WebDriver represents a significant advantage over RC. For things that can comfortably be done within JavaScript, like finding an element, determining its visibility, and the like, JavaScript is the correct way to handle them, since it provides a way to only maintain one set of source code for those actions.  Also, please note that the execution of JavaScript is not done from within a hosting frame, like Selenium RC did, but rather injected and executed directly into the page being automated, eliminating the "same origin policy" problem.

Ashok Tulachan

unread,
Oct 17, 2012, 6:45:59 PM10/17/12
to seleniu...@googlegroups.com
Hi Jim,
 
Thank you for your clear explanation. Now I see the reason behind the slowness of IE since I am still using IE8.
 
Also since the customers for our work site is mostly IE7 & IE8, Unfortuantely I have to stick with slowness of IE8.
 
Thank you again like always for your insightful explanation.
 


 
--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To post to this group, send email to seleniu...@googlegroups.com.
To unsubscribe from this group, send email to selenium-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/selenium-users/-/nPh0_2H5J2UJ.

For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
- "If you haven't suffered, you haven't lived your life."

Regards,
Ashok Tulachan
 

Peter Gale

unread,
Oct 17, 2012, 6:57:05 PM10/17/12
to Selenium Users
Run the bulk of your testing in a faster browser like Firefox or Chrome, and only run them in IE less often to check for IE specific issues.


Date: Wed, 17 Oct 2012 17:45:59 -0500
Subject: Re: [selenium-users] Re: How to speed up IE tests?
From: tulach...@gmail.com
To: seleniu...@googlegroups.com

Mike Riley

unread,
Oct 18, 2012, 1:25:16 PM10/18/12
to seleniu...@googlegroups.com
I would add that I found IE9 (32-bit) to run slower than IE8 running my XPath-heavy test scripts.  In many cases IE7 even beat it!

My test environment I was forced to mostly use XPath locators, due to the design of the site.  I was very surprised at that result, as I figured it would be at least comparable to IE8 and I thought the new engine would make it faster.

Thanks for the explanations of the various issues that can cause speed differences in the tests, Jim.

Mike
Reply all
Reply to author
Forward
0 new messages