Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Speeding up Selenium Webdriver

I am using Selenium Webdriver (2.0) under the Perl language bindings, with Firefox 20. It is incredibly slow. For example, one common operation is to fill in a couple of <input type="text"> fields with an ID and password. I could type it in 2 to 3 times faster than Selenium does a 'send_keys' method. Locating elements, such as a table cell with specific text in a large table, is like watching paint dry.

I thought that maybe there is some sort of default speed setting that wasn't at its highest value, but the get_speed and set_speed methods have been removed. So, is Selenium already running flat out, or is there some setting I can tweak? I've seen many questions about how to slow down Selenium, but at this time I'm looking for how to speed it up. I'll worry about slowing it down later, if necessary.

  • Perl: Strawberry Perl 5.16.3 (driver for test program)
  • Java: 1.7.0_21-b11 (for the Selenium Server .jar file) (32 bit)
  • Selenium::Remote::Driver: 0.16 via CPAN (Perl language bindings)
  • Selenium-Server-Standalone: 2.32.0
  • OS: Windows 7 Professional, SP 1 (64 bit)
  • hardware: Dell Precision T1650 (Xeon 3.5GHz 16GB RAM)
  • browser: Firefox 20.0.1 with Selenium IDE 1.10.0 (production users will have Chrome, IE9, Opera)

Since even an "atomic" operation such as entering text into an input field is so slow, I don't think it's an issue with using XPath locators rather than CSS, or Perl instead of some other language. It's been suggested that I try Chrome instead of FF -- can it help that much? I do a lot of locating text within table cells, so CSS locators are unfortunately of limited value.

Thanks much for any help on this! I'm going to look real bad if this test automation isn't faster than manually running the tests!

like image 950
Phil Perry Avatar asked May 31 '13 18:05

Phil Perry


People also ask

Which Selenium WebDriver is fastest?

HTML UnitDriver is the most light weight and fastest implementation headless browser for of WebDriver. It is based on HtmlUnit. It is known as Headless Browser Driver.

How do I speed up automation scripts?

Reduce the time it takes for your automated scripts to complete compared to a GUI browser. GUI browsers will have to load CSS, images, render HTML and this will increase the time your script takes to run. Are useful when the test execution server has no GUI.

Why is Selenium running slow?

Generally, Selenium WebDriver scripts are very slow because they run through the browser.


1 Answers

A bit late to the party but there is the phantom driver http://phantomjs.org/ which doesn't use a screen driver and can be hooked into selenium.

  ./phantomjs --webdriver=5556 --webdriver-selenium-grid-hub=http://localhost:4444

Or link it to a remote hub

like image 111
KeepCalmAndCarryOn Avatar answered Oct 05 '22 11:10

KeepCalmAndCarryOn