WebElement sendKeys not working under Jenkins/Linux

Hello friends,

I recently asked how to clear a TextField in Firefox, cause I had some problems:

I got a solution from @Brandon_Hein that is working fine on my local Windows system.
But I realized it is not, when I execute the same test on our Jenkins (Linux), with headless Firefox.

Here again, how my method/class looks like, in case I made a stupid mistake:
(But it was running well on my lokal Windows system, as I mentioned above)

...
import com.kms.katalon.core.webui.common.WebUiCommonHelper
...

class TestUtilities {
    ...
    static void clearText(TestObject testObject) {
        WebElement element = WebUiCommonHelper.findWebElement(testObject, GlobalVariable.timeout);
        element.sendKeys(Keys.chord(Keys.CONTROL, 'a'));
        element.sendKeys(Keys.DELETE);
    }
}

As it throws an ElementNotInteractableException I tried to click the element before executing my “clearText”-method.
And I also wrote my own click-Method, with a scroll and wait command inside to be sure it will reach the element.

static void click(TestObject testObject) {
    WebUI.scrollToElement(testObject, GlobalVariable.timeout)
    WebUI.waitForElementClickable(testObject, GlobalVariable.timeout)
    WebUI.click(testObject)
}

But Im still getting this exception.
Any further Idea, what I can do?

Thanks,
Simon

A couple of questions to narrow down the problem:
1.) Do you have the same issue with headless Chrome on the linux box?
2.) Which part of the method is failing, specifically? Is it the ctrl + a piece or the delete?

Hi @simon.klotz,
Sounds like you may need to set the focus first. The following works for me in Chrome, it might work for you?

WebUI.enhancedClick(findTestObject(‘yourTestObject’))
WebUI.clearText(findTestObject(‘yourTestObject’))
WebUI.sendKeys(findTestObject(‘yourTestObject ’), ‘Any text value’)

I was not able to test it right now, cause there is no chrome installed on this linux-system. And I am not the admin. But if necessary I will tell our admin to install it.

It’s the first sendKeys-command executed, so it is ctrl + a.

I tried executing the enhancedClick before my own clearText method but same result.
I stopped using the WebUI.clearText method, cause it is not working for this special kind of field (and other cases → see my last topic I posted above)
It is an angular frontend and here I try to change the value of a field, that looks like this:
image
But after executing the WebUI.clearText & WebUI.setText, nothing changed.
With my own clearText & WebUI.setText, it works, but only on my Windows system.
(I think the difference is, that I execute ctrl + a in my own clearText)

Hi @simon.klotz, sorry I misunderstood your issue.

@Dave_Evers
ah no problem, you tried to help me and even had a potential solution.
The “WebUI.enhancedClick()” could also have helped me.
No reason to say sorry :slight_smile: