Hi Katalon Team
I have problems running a test case on Chrome
The test starts well, setting text correctly into an input field, then validate ok
Then, when trying to set a text into another input field on the next page, Katalon throws exception :
Caused by: org.openqa.selenium.NoSuchElementException: no such element: Element_id length is invalid
At object: 'Object Repository/WEB/inputTest'
Here’s my code, quite simple :
WebUI.openBrowser('xxx')
WebUI.setText(findTestObject('WEB/inputFirst'), 'ok') //works fine
WebUI.click(findTestObject('WEB/buttonNext'))
WebUI.setText(findTestObject('WEB/inputTest'), 'ko') //doesn't work
I have the same problem with Edge, but it’s ok with Firefox
Here is complete error log :
2021-01-14 18:01:22.869 DEBUG testcase.test - 7: setText(findTestObject("WEB/inputTest"), "Hello")
2021-01-14 18:01:23.966 ERROR c.k.k.core.keyword.internal.KeywordMain - ❌ Unable to set text 'Hello' of object 'Object Repository/WEB/inputTest' (Root cause: com.kms.katalon.core.exception.StepFailedException: Unable to set text 'Hello' of object 'Object Repository/WEB/inputTest'
at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.stepFailed(WebUIKeywordMain.groovy:64)
at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.runKeyword(WebUIKeywordMain.groovy:26)
at com.kms.katalon.core.webui.keyword.builtin.SetTextKeyword.setText(SetTextKeyword.groovy:66)
at com.kms.katalon.core.webui.keyword.builtin.SetTextKeyword.execute(SetTextKeyword.groovy:37)
at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:73)
at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords.setText(WebUiBuiltInKeywords.groovy:977)
at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords$setText$0.call(Unknown Source)
at test.run(test:47)
at com.kms.katalon.core.main.ScriptEngine.run(ScriptEngine.java:194)
at com.kms.katalon.core.main.ScriptEngine.runScriptAsRawText(ScriptEngine.java:119)
at com.kms.katalon.core.main.TestCaseExecutor.runScript(TestCaseExecutor.java:394)
at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:385)
at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:364)
at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:356)
at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:251)
at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:114)
at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:105)
at com.kms.katalon.core.main.TestCaseMain$runTestCase$0.call(Unknown Source)
at TempTestCase1610643663403.run(TempTestCase1610643663403.groovy:25)
Caused by: org.openqa.selenium.NoSuchElementException: no such element: Element_id length is invalid
Hi grylion54, Hi kazurayam,
thanks a lot for your replies
I tried both of your proposals, and it still not working
The verifyElementPresent is ok :
01-15-2021 11:18:06 AM verifyElementPresent(findTestObject("WEB/inputTest"), 10)
Elapsed time: 0,479s
Object 'Object Repository/WEB/inputTest' is present
but then I face the same mistake than before when trying to clearText (by the way, there’s no text in that input) :
=============== ROOT CAUSE =====================
Caused by: org.openqa.selenium.NoSuchElementException: no such element: Element_id length is invalid
At object: 'Object Repository/WEB/inputTest'
...
01-15-2021 11:18:06 AM clearText(findTestObject("WEB/inputTest"))
Elapsed time: 1,126s
Unable to clear text of object 'Object Repository/WEB/inputTest' (Root cause: com.kms.katalon.core.exception.StepFailedException: Unable to clear text of object 'Object Repository/WEB/inputTest'
I tried to setText without using clearText, and after the verifyElementPresent : still not working
Hi @Russ_Thomas,
thank you for your reply
Unfortunately, it’s still not working with your proposals, i’m facing the same issues
Have you noticed that the error thrown is “Element_id length is invalid” ? I haven’t found much information with this kind of error. It’s not just a simple “Element not found” exception or something like this, that’s why I’m a bit lost…
Yes, I noticed. I did a web search for it and found nothing useful.
For this to proceed and make progress, I would suggest you give me a screenshot that shows the HTML you’re trying to setText on. Make sure you include enough of the HTML so I can see the element’s hierarchy. With that, I can hopefully write a few lines of JavaScript that can make this work.
I think I might know what’s wrong. There are numerous input elements with the same name. If your TestObjects are using those as part of their identity, I suspect that’s why you’re seeing weird issues.
Also, they’re in a form element. When that form is submitted, I have no clue how the server is supposed to make sense of that. But maybe I just don’t know what happens “next” before submit.
Anyway, here’s your JavaScript…
Be sure to continue waiting until the element is visible, then…
I do not see what this javascript does. But I guess, ‘length’ in the javascript may have something to do with the error message “Element_id length is invalid”.
I do not see what this extension is. But I guess, this would do something special only on Chrome. So it might have something to do with your issue.
3 Years ago, I encountered an incident where I opened Chrome browser using WebUI.openBrowser() then Katalon Studio opened a bare plain Chrome WITHOUT any custom chrome-extensions installed.
You can make a search this forum with keyword “chrome extension”, then you will find many topics where people had hard time. I do not know any quick answer to this issue.
In your case, your HTML has a line <script src="chrome-extension://obmgakbogf.... but this chrome extension may not available. I am not sure, only you can check it.
I can not see which HTML element is selected by these TestObjects ‘WEB/inputFirst’, ‘WEB/buttonNext’, ‘WEB/inputTest’. I need to see the locators (xpath or css selector).
Could you share the screenshot of the definition panel of these TestObjects ?
Hi everybody
sorry for the delay, I was away for a few days
Thanks a lot for all your replies, I will analyse all of these and will get back at you to tell if something solves my problem
Do you have any iframes involved? I faced a similar issue after clicking on a button that triggered a popup, and after closing the popup, I could no longer interact with form fields. I fought this for days until I tried using WebUI.switchToDefaultContent() which solved all my issues. Maybe it can help you to.
Hi Kazurayam,
I looked at this extension, and it seems to be something from Katalon, an extension only visible while running tests
Here is what I can see in chrome://extensions on the chrome window controled by Katalon :
So I don’t think this has something to do with my issue
I tried to delete the extension and then run the script again on the same chrome session, and problem was still there
There are numerous input elements with the same name. If your TestObjects are using those as part of their identity, I suspect that’s why you’re seeing weird issues
I am using the id = exploi, and it seems it’s the only object with this ID. Furthermore, I have no ID problem when using firefox
I indeed have some iframes involved, but I manage them fine, proof is that everything works just fine using firefox. Problems are only with Chrome, that’s what making me crazy