Enhance WebUI Keyword to work with EventFiringWebDriver

When it comes to pages with lots of templates/forms to fill in, issues like “StaleElementException” or “Object not clickable, other element would receive the click at point(x/y)”

will show up a lot.

Sure, there is the option already to use things like wit for jquery/angular, nevertheless,

  • I got to keep this in mind

  • plus I have to add it to my test steps - every time I may run into a probable Ajax call.

I’d love having this to be implicit.

(e.g. in TestCase/Suite Setup or something where I may define how to deal with Ajax for the entire test).

Or: By a change in the Way I ought work with the DriverFactory/WebUiBuiltInKeywords.

I’ve been trying to marry the “DriverFactory.changeWebDriver” with the approach below, of course it’s not working due current implementation.

WebDriverEventListener edriver

an object called “basalwebdriver” which is either referencing “DriverFactory.getWebDriver()” or “new RemoteWebDriver(remoteAddress, desiredCapabilities)”

edriver= new EventFiringWebDriver(basalwebdriver)

edriver.register(handle)

ActivityCapture handle= new ActivityCapture()

ActivityCapture implements org.openqa.selenium.support.events.WebDriverEventListener

In the ActivityCapture class I could define multiple approaches for Ajax handling/logging/etc pp.

4 Likes

Yes exactly this. I tried also and got a ClassCastException

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

Tom Longhurst said:

Yes exactly this. I tried also and got a ClassCastException

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

Hi all,

Thank you for choosing Katalon Studio and Sorry for the delay response.

This is not a bug from the Katalon app but something not supported properly yet. We do have the plan to support EventFiringWebDriver in the future releases.

Please let us know if you have further issues or suggestions.

Best,
Liam

2 Likes

Thanks Liam,

That’s great news.
Is there an ETA for this at all? It’s quite important for our testing.

Either this, or something similar to a test listener, but for before and after individual actions/steps.

The reason for this is our web app is based off of ExtJS, and when changing data in certain fields, or pressing certain buttons, interaction with the web app is disabled until an Ajax call is completed.

So I need to perform a javascript executor to determine when the page is ready and to move on to the next action.

At the moment, because it isn’t doing this, I’m getting errors such as Element not clickable, other element would receive click.

I understand I could put individual wait steps in, but I’d have to put them between every other action/step which is extremely tedious.

Thanks

I might be wrong, but is it not as simple as extending the DriverFactory.getWebDriver() from

if (driverObject instanceof RemoteWebDriver) {
    return (RemoteWebDriver)driverObject;
}toif (driverObject instanceof EventFiringWebDriver) {
    return (EventFiringWebDriver)driverObject;
}