What would be a possible reason that tests pass in chrome but failed in firefox- particularly i was trying to send text to the input box which worked in chrome. I was able to send in firefox too but was not saved

What would be a possible reason that tests pass in chrome but failed in firefox- particularly i was trying to send text to the input box which worked in chrome. I was able to send in firefox too but was not saved.

Problem Analysis

Your issue is a classic cross-browser testing problem where text is successfully sent to an input field in Firefox but not persisted. This typically occurs because Firefox and Chrome handle JavaScript events and DOM updates differently, particularly when using Katalon’s text input methods.

Root Causes

1. Missing JavaScript Event Triggers
The primary culprit is that WebUI.setText() in Katalon injects text directly into the element’s property without firing companion JavaScript events like change, input, keydown, or blur. Many web applications rely on these events to trigger save logic or data persistence. Firefox may be more strict about requiring these events to fire before persisting data, while Chrome may handle it more leniently.

2. Browser-Specific Event Handling Differences
Firefox and Chrome handle the blur event differently in certain scenarios. In Firefox, the blur event may not fire when it would in Chrome, especially if the element’s parent is hidden or if there are timing issues. This prevents your application’s save handlers from executing.

3. Timing and Synchronization Issues
Firefox and Chrome execute JavaScript and handle DOM mutations at different speeds. Your test may proceed to verify the saved data before Firefox has completed the event handling chain and persistence logic. Chrome’s faster execution may mask this timing issue.

4. DOM Rendering Differences
Each browser handles DOM updates and CSS animations differently, which can affect when and how your application’s JavaScript responds to input changes.

Solutions

Option 1: Trigger Events Manually After setText()
After using WebUI.setText(), explicitly trigger the necessary events:

// Set the text
WebUI.setText(findTestObject('Object Repository/input_field'), 'Your Text')

// Trigger the blur event to simulate user leaving the field
WebUI.executeJavaScript('arguments[0].blur()', findTestObject('Object Repository/input_field'))

// Or trigger change event
WebUI.executeJavaScript('arguments[0].dispatchEvent(new Event("change", { bubbles: true }))', findTestObject('Object Repository/input_field'))

Option 2: Use sendKeys() Instead of setText()
sendKeys() more closely mimics actual user typing and is more likely to trigger events:

WebUI.sendKeys(findTestObject('Object Repository/input_field'), 'Your Text')

Option 3: Add Explicit Waits
Ensure Firefox has enough time to complete event handling and persistence:

WebUI.setText(findTestObject('Object Repository/input_field'), 'Your Text')
WebUI.delay(1) // Add delay for Firefox to process
WebUI.executeJavaScript('arguments[0].blur()', findTestObject('Object Repository/input_field'))
WebUI.waitForElementPresent(findTestObject('Object Repository/saved_indicator'), 10)

Option 4: Use Actions API for More Natural Input
The Actions API simulates more realistic user interactions:

WebUI.click(findTestObject('Object Repository/input_field'))
WebUI.sendKeys(findTestObject('Object Repository/input_field'), 'Your Text')
WebUI.sendKeys(findTestObject('Object Repository/input_field'), Keys.TAB) // Trigger blur

Key Considerations

  • Avoid mixing implicit and explicit waits - this can cause unpredictable wait times
  • Test with both methods - if setText() doesn’t work in Firefox, switch to sendKeys() which better simulates user behavior
  • Browser-specific testing - always test critical workflows in both Chrome and Firefox, as they may behave differently
  • Event-driven applications - if your application heavily relies on JavaScript events for data persistence, manually triggering events after text input is essential

References

The core issue is that Firefox is more strict about JavaScript events than Chrome when handling text input. Your text is being sent to the input field in both browsers, but the save logic isn’t triggering in Firefox because required events (change, input, blur) aren’t firing.

Root Cause: WebUI.setText() Doesn’t Fire Events

Method What It Does Event Triggers
WebUI.setText() Injects text directly into the element’s property No change, input, keydown, or blur events
WebUI.sendKeys() Mimics actual user typing Yes — triggers events naturally

Many web applications rely on these events to trigger save logic. Chrome handles this leniently, but Firefox requires the events to fire before persisting data.

Solutions (Try in Order)

:white_check_mark: Option 1: Use sendKeys() Instead of setText() (Recommended)

// Better: mimics actual typing and triggers events**
WebUI.sendKeys(findTestObject('Object Repository/input_field'), 'Your Text')**

:white_check_mark: Option 2: Trigger Events Manually After setText()

If you must use setText(), explicitly fire the events Firefox expects:

// Set the text**
WebUI.setText(findTestObject('Object Repository/input_field'), 'Your Text')

// Trigger blur event (simulate user leaving the field)
WebUI.executeJavaScript('arguments[0].blur()', findTestObject('Object Repository/input_field'))

// Or trigger change event
WebUI.executeJavaScript('arguments[0].dispatchEvent(new Event("change", { bubbles: true }))', findTestObject('Object Repository/input_field'))**

:white_check_mark: Option 3: Add Explicit Waits for Firefox

WebUI.setText(findTestObject('Object Repository/input_field'), 'Your Text')
WebUI.delay(1) // Wait for Firefox to process events
WebUI.executeJavaScript('arguments[0].blur()', findTestObject('Object Repository/input_field'))
WebUI.waitForElementPresent(findTestObject('Object Repository/saved_indicator'), 10)

:white_check_mark: Option 4: Use Actions API for Natural Input

WebUI.click(findTestObject('Object Repository/input_field'))
WebUI.sendKeys(findTestObject('Object Repository/input_field'), 'Your Text')
WebUI.sendKeys(findTestObject('Object Repository/input_field'), Keys.TAB) // Trigger blur via TAB

Key Takeaways

Issue Fix
Text not saved in Firefox Use sendKeys() instead of setText()
Events not firing Manually trigger blur() or change events after setText()
Timing issues Add delay(1) or waitForElementPresent() for Firefox’s slower JS execution
Event-driven apps Always trigger events manually if persistence relies on JavaScript event

Quick fix: Switch from setText() to sendKeys() — it’s more likely to work in Firefox without extra code

hi @agebrewold

setText() skips the JavaScript events your app needs to save the data. Firefox cares about this more than Chrome

just use sendKeys() instead. It types like a real person and fires the right events:

WebUI.sendKeys(findTestObject('Object Repository/input_field'), 'Your Text')

or if you want to stick with setText(), tab off the field after to trigger the save:

WebUI.setText(findTestObject('Object Repository/input_field'), 'Your Text')
WebUI.sendKeys(findTestObject('Object Repository/input_field'), Keys.chord(Keys.TAB))

did u check the solutions as stated above

Yes, API actions seem to be helpful at this time.