Keyup

This is probably simple, but for the life of me, I cannot figure out how to get a keyUp method on a field to trigger on a text field. Can someone point me in the right direction? I have used WebUI.setText and WebUI.sendKeys, but neither seem to fire keyUp. This prevents the js validation from happening.

You could trigger keyUp via executeJavaScript:

https://docs.katalon.com/display/KD/[WebUI]+Execute+JavaScript

Russ Thomas said:

You could trigger keyUp via executeJavaScript:

https://docs.katalon.com/display/KD/[WebUI]+Execute+JavaScript

Thanks. After a good bit of tinkering, it works. For posterity, I have left what worked, though I’m sure someone more experience can condense it some.

String js = '''    var keyboardEvent = document.createEvent('KeyboardEvent');     var initMethod = typeof keyboardEvent.initKeyboardEvent !== 'undefined' ? "initKeyboardEvent" : "initKeyEvent";     keyboardEvent[initMethod]("keyup", true,true,window,false,false,false,false, 40,0 );     arguments[0].dispatchEvent(keyboardEvent);  '''; WebUI.setText(findTestObject('someObject'), 'SomeText')WebUI.delay(1) // Fails without delayWebElement element = WebUiCommonHelper.findWebElement(findTestObject(someObject'),30)WebUI.executeJavaScript(js, Arrays.asList(element))

Thanks for the BA, Kyle B)

Sure, if you write more JS stuff (I use it a lot) then you’re very likely to want to write a few helper functions that you can call from Test Cases with greater ease.

For your example (and since I have jQuery available), it’s a one-liner $("#thing").keyup()