Run code/method between actions

There is a delay between actions option, but I would like the option to execute code in-between actions.

Our web-app is based off of ExtJS and needs a javascript executor to determine whether the page is ready.

I want to avoid putting waits in every other step, and would rather this is just done automatically so we don’t have to worry about missing them.

Thanks

2 Likes

Hey Tom

I use the JavaScript executor all the time for exactly those purposes (and more). I can confirm it works well.

I think a test listener will suit your needs:

https://docs.katalon.com/pages/viewpage.action?pageId=5126383

Hey Russ,
Thanks, but that looks like it only gives you options for before/after a test case/suite.
I need something like this, but gives me control over before/after each action/step of a test case.

I found a Selenium EventFiringWebDriver which would also do exactly what I need, but I tried changing the default webdriver in DriverFactory and got errors.

Code:

EventFiringWebDriver eventDriver = new EventFiringWebDriver(DriverFactory.getWebDriver());

KatalonWebDriverEventHandler handler = new KatalonWebDriverEventHandler();

eventDriver.register(handler);

DriverFactory.changeWebDriver(eventDriver);

I got this exception:
org.openqa.selenium.support.events.EventFiringWebDriver cannot be cast to org.openqa.selenium.remote.RemoteWebDriver

1 Like

Hi Tom

Thanks, but that looks like it only gives you options for before/after a test case/suite.

Reminder to self: don’t reply until AFTER first cup of coffee. :s

I’ve never tried messing with the incumbent driver. I’ll read up on it.