This is a companion discussion topic for the original entry at https://docs.katalon.com/katalon-studio/docs/headless-browsers-execution.html
This is a companion discussion topic for the original entry at https://docs.katalon.com/katalon-studio/docs/headless-browsers-execution.html
Will we eventually be able to do headless testing on Edge?
My Headless Browser executions keep failing. Mostly Chrome(headless) fails. But in some cases, firefox too. Below is the error message I see. Please help. Thank you
Verify element text of test object âObject Repository/Page_AlertFind/span_User Listâ FAILED. (Root cause: com.kms.katalon.core.exception.StepFailedException: Verify element text of test object âObject Repository/Page_AlertFind/span_User Listâ FAILED.
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.VerifyElementTextKeyword.verifyElementText(VerifyElementTextKeyword.groovy:72)
at com.kms.katalon.core.webui.keyword.builtin.VerifyElementTextKeyword.execute(VerifyElementTextKeyword.groovy:40)
at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:72)
at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords.verifyElementText(WebUiBuiltInKeywords.groovy:3663)
at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords$verifyElementText$3.call(Unknown Source)
at C25731044 - MOAFCID-33217 - E2E test to create a dedicated regular user for QA with standard devices configured for bytestacker customer.run(C25731044 - MOAFCID-33217 - E2E test to create a dedicated regular user for QA with standard devices configured for bytestacker customer:65)
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:337)
at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:328)
at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:307)
at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:299)
at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:233)
at com.kms.katalon.core.main.TestSuiteExecutor.accessTestCaseMainPhase(TestSuiteExecutor.java:169)
at com.kms.katalon.core.main.TestSuiteExecutor.accessTestSuiteMainPhase(TestSuiteExecutor.java:142)
at com.kms.katalon.core.main.TestSuiteExecutor.execute(TestSuiteExecutor.java:91)
at com.kms.katalon.core.main.TestCaseMain.startTestSuite(TestCaseMain.java:157)
at com.kms.katalon.core.main.TestCaseMain$startTestSuite$0.call(Unknown Source)
at TempTestSuite1582718925380.run(TempTestSuite1582718925380.groovy:36)
Caused by: com.kms.katalon.core.exception.StepFailedException: Actual text ââ and expected text âUser Listâ of test object âObject Repository/Page_AlertFind/span_User Listâ are NOT matched.
at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.stepFailed(WebUIKeywordMain.groovy:64)
at com.kms.katalon.core.webui.keyword.builtin.VerifyElementTextKeyword$_verifyElementText_closure1.doCall(VerifyElementTextKeyword.groovy:57)
at com.kms.katalon.core.webui.keyword.builtin.VerifyElementTextKeyword$_verifyElementText_closure1.call(VerifyElementTextKeyword.groovy)
at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.runKeyword(WebUIKeywordMain.groovy:20)
⌠19 more
)
I think you should add some of the explicit or implicit wait to your test scripts and check again if the test still fail.
Hi, I am having exactly the same error as yours!! Did you find a solution already?
Thanks!
You can try âwaitForElementVisibleâ. This actually solved my issue. Please try and use timeout as 5 mins or so just to be sure. 300 seconds. Please let me know if it works for you too.
Thank you for the quick reply! I tried the method you mentioned to wait for element visible for 300 sec, but still out of luck. I think it might be an issue related with my element class attribute which is hidden. Which not make sense that while I run a script in Chrome, the element pass just fine. However, while I run the same script in Chrome headless, now the element wonât be visible no more no matter how long I wait. Anyway, I am really appreciate your help!
Hi I am getting the same behavior. Did you get to find a solution? I appreciate your help
Why ks 7.6 does not support part from chrome driver.pls anyone give the solution
Hi @mthuvtb42
You should click on the Value cell then click on the square button at the right conner to edit the value of the selected desired property.
I often find my tests pass consistently in GUI mode but fail in Headless mode for reasons like âElement not Interactableâ or âElement Interceptedâ. I am slowly converting these failed clicks to JavaScript clicks, but feels like Iâm losing a lot of the value of the Katalon âClickâ keyword by doing this across many test cases and steps.
Does anyone have any useful feedback on this issue? I have seen it mentioned many times in posts, and âJavaScriptâ clicks seem to always be the most consistent answer (if âwaitâ or âwait until elementâŚâ keywords donât work), but Iâm curious what Katalon has to say about why their own âClickâ keyword is not reliable to use in Headless mode, which is the standard for testing in modern CI/CD pipelines?
Who said headless mode is the standard in modern testing?
As far as i know headless mode is mostly used by developers to quickly rander the DOM.
Have no connection with propper UI testing where a real display may be needed⌠Oor at least a virtual one
ya, I like the UI mode, but my management team continually pushes me towards headless testing so we can integrate with Jenkins and run these tests more quickly in scenarios like when PRâs are created and/or merged. Should I look into running these tests in UI mode on a remote machine? Any guidance on where I can find more info on the correct standards to apply/>
Your management team is confused.
You can execute relevant ui tests in docker containers on a headless machine using the normal webdriver (because xvfb, this i why we have it)
Or yeah, even better, remote execution on a relevant cloud stack or self hosted grid.
That will be modern testing.
And yeah, all off them can be done through jenkins or any other CI tool
thank you for this feedback! I really appreciate it.
Hello everyone, I having issues running test cases on headless chrome, one of my test need to check the value of an span element that by default is 0 but when server response, change it value with another number value, so Iâm checking this value is greater than some value. On UI chrome the test run fine, but with headless version it always getting the 0 value and fail, but if I set a 3 seconds delay before that validation, the test got pass. My question is, is there a way to wait until element change it html value?
There is no keyword named âWebUI.waitForElementTextâ nor âWebUI.verifyElementTextâ which wait for condition to be true. But there is an alternative. You can use âWebUI.waitForElementPresentâ or âWebUI.verifyElementPresentâ. These keywords have âtimeoutâ parameter. These can wait for the target element turned to be present.
You want to specify a TestObject with a XPath locator. The locator should look for an HTML element of which content text is equal to the value you expect. The following code demonstrates my idea.
import com.kms.katalon.core.model.FailureHandling
import com.kms.katalon.core.testobject.ConditionType
import com.kms.katalon.core.testobject.TestObject
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI
WebUI.openBrowser("")
WebUI.navigateToUrl("http://demoaut.katalon.com/")
//TestObject tObj = createTestObject("//a[text()='Make Appointment']") // should PASS
TestObject tObj = createTestObject("//a[text()='Make DisAppointment']") // should FAIL
// the following waits for the HTML element to be present for 3 seconds,
// would pass if found in 3secs, would fail if not found in 3secs
boolean b = WebUI.verifyElementPresent(tObj, 3, FailureHandling.CONTINUE_ON_FAILURE)
WebUI.comment("present? : ${b}")
WebUI.closeBrowser()
//
TestObject createTestObject(String xpath) {
TestObject tObj = new TestObject(xpath)
tObj.addProperty("xpath", ConditionType.EQUALS, xpath)
return tObj
}