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();
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.
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.
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 :).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With