Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Selenium WebDriver- How to control the speed of running the test cases

I am using Selenium WebDriver with Java. I want to control the speed of the execution of running the test cases.

The WebDriver doesn't have a method setSpeed() (Selenium RC has this method). Also I am not using a selenium server.

WebDriver driver = new FirefoxDriver();
like image 592
Mohamed Ramadan Avatar asked Jan 25 '12 22:01

Mohamed Ramadan


People also ask

How do you slow down a test execution in Selenium WebDriver?

Basically, you would want to reduce a speed of Selenium WebDriver to make sure that your script does not fail as the element does not appear or takes time to appear. You can mostly do this by implementing Implicit Wait or Explicit wait. WebDriverWait wait = new WebDriverWait(driver, 10); WebElement element = wait.

Why is Selenium execution slow?

The Selenium test is executed on your local computer, or a virtual machine or in a container. If the hardware resources are limited, your Selenium test cannot be fast. There is a big difference between your environment having 1 core or 8 cores. Or between 1 GB memory instead of 6 GB.


1 Answers

If you are looking to explicitly control the 'speed' of the execution using methods,I have found this link wherein a similar issue is discussed/answered.

Apart from that I think , that if we are looking at speed with efficiency/accuracy in mind, we should follow good practices as in efficient locator strategies , among others.

Or in some cases wherein if we have to interact with Ajax, we could use wait judiciously.More info here.

Hope this is useful :).

like image 79
self-babush Avatar answered Oct 01 '22 07:10

self-babush