简体   繁体   中英

Configure execution speed of steps in WebDriver Script like Selenium IDE Throttling

So, in the Firefox Selenium IDE, you are able to "throttle" the script by adding a pause between each command using a slider from "Fast" to "Slow". I was wondering if this can be simulated in a Java WebDriver script? Everywhere I look uses implicit waits which I don't believe is the same thing. What I want is more of an automatic Thread.sleep between commands.

Is this possible?

I don't think there is a reason really for you to hard-code pauses in your test code. If you code your tests correctly, using the right ExpectedConditions and exception handling, you shouldn't need to put pauses in your tests to get them to behave successfully.

If you actually want to throttle to slow down web performance, then you probably want to user BrowserMob Proxy .

In theory, you could use Aspect Oriented Programming (AOP) to listen for events and pause on them dynamically. For example, I use AOP to pause a certain number of milliseconds between page transitions depending on how I configure it.

Instead of using Thread.sleep, which requires you handle the InteruptedException, I user Selenium Sleeper class (which might get deprecated in Selenium 3.0?)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM