Selenide Slow Down Execution

32 views
Skip to first unread message

Andre Steenkamp

unread,
Feb 8, 2024, 9:12:19 AMFeb 8
to sele...@googlegroups.com
Hi guys,

Is there a way to slow down the execution of steps in Selenide?

I am not referring to waiting on elements to be visible or clickable etc I do all those things but I am purely talking from the perspective of showing your automation to colleagues by slowing down each click or action you do.

Putting Selenide.sleeps everywhere you want a delay looks very messy and I know other automation tools such as Playwright has a config option to do this exact thing, again purely for the purposes of showcasing what your automation is doing to a person in real time.

Thank you
Andre

Andrei Solntsev

unread,
Feb 8, 2024, 11:13:19 AMFeb 8
to Andre Steenkamp, sele...@googlegroups.com
Hi Andre.

In Selenide, you can add WebDriverListener that intercepts any web driver calls (find, click, sendKeys - whatever). 
You can make pauses, take screenshots, highlight elements - whatever you wish.

Something like this:

WebDriverRunner.addListener(new WebDriverListener() {
@Override
public void beforeAnyCall(Object target, Method method, Object[] args) {
sleep(200);
}

@Override
public void afterAnyCall(Object target, Method method, Object[] args, Object result) {
if (target instanceof WebElement) {
$((WebElement) result).highlight();
sleep(200);
}
}
});
Andrei Solntsev


чт, 8 февр. 2024 г. в 16:12, Andre Steenkamp <andrejs...@gmail.com>:
--
You received this message because you are subscribed to the Google Groups "selenide" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenide+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenide/CAFFPViHNmZUqPxvD-k8Fi0yn9q7xjZ-kpEzxxZ8r7NqTXUt1gg%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages