Phil Perry
Phil Perry

Reputation: 2130

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.

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!

Upvotes: 8

Views: 3684

Answers (3)

Moradnejad
Moradnejad

Reputation: 3663

For anyone coming to this question:

Selenium tests have evolved in a lot of ways and they are running at faster speeds than before.

But in order to make your tests run much faster, use the headless mode, which does not open any windows for testing. It is available, both in chromedriver and geckodriver.

Upvotes: 0

jake
jake

Reputation: 2411

This may not be directly applicable, but you can follow a few simple tips to first investigate where most of the time is spent. Look at the article below:

https://blog.mavenhive.in/7-tips-to-speed-up-your-webdriver-tests-4f4d043ad581

I guess most of these are generic steps which would apply irrespective of the tool used for testing too.

Upvotes: 0

KeepCalmAndCarryOn
KeepCalmAndCarryOn

Reputation: 9075

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

Upvotes: 2

Related Questions