Hi community! This test has been working fine previously, but a few days ago the click method doesn’t seem to be working with this particular button. After entering credentials, you’re prompted for a 2FA, so when you click submit, the button is clicked, and you’ll be able to see on the gif, the action is perfomed and seems to be loading, but then it stops.
This is the html of the button. I tried with different locators (from the div and the label), IDs are dynamic, so I used xpath or different combination of selectors, using both the Click method form Katalon and also with JavaScript executor, but nothing worked. Same result in both cases
These are both the pieces of code I tried with Click:
If that doesn’t work, then you might not be addressing the correct element. To prove the point, bring up the page in the browser and enter the following in the browser console:
So, I also tried with the second piece of code you sent, but nothing changed.
When testing that on the browser console as you mentioned, it seems it’s correctly being clicked, because this alert showed up (there were no values on the field). Unless I’m not understanding the result the way it should be.
Could it be something related to the page itself? I also tried looking at the dev console while running the test, but didn’t see anything unsusual, though I don’t know exactly what to look at either
First, thank you so much for taking the time to provide help. Using the code just as you wrote it, it’s still behaving the same way the rest of the previous attempts. If I add the single quotes to Submit, it throws me an exception “javascript error: missing ) after argument list”
Test Cases/Steps/NS_Login FAILED.
Reason:
com.kms.katalon.core.exception.StepFailedException: Unable to execute JavaScript.
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.ExecuteJavaScriptKeyword.executeJavascript(ExecuteJavascriptKeyword.groovy:42)
at com.kms.katalon.core.webui.keyword.builtin.ExecuteJavaScriptKeyword.execute(ExecuteJavascriptKeyword.groovy:37)
at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:72)
at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords.executeJavaScript(WebUiBuiltInKeywords.groovy:3787)
at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords$executeJavaScript$6.call(Unknown Source)
at NS_Login.run(NS_Login:51)
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.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 TempTestCase1663355301433.run(TempTestCase1663355301433.groovy:23)
Caused by: org.openqa.selenium.JavascriptException: javascript error: missing ) after argument list
(Session info: chrome=105.0.5195.125)
Build info: version: ‘3.141.59’, revision: ‘e82be7d358’, time: ‘2018-11-14T08:25:53’
System info: host: ‘EZE1-LLN-B03024’, ip: ‘192.168.0.137’, os.name: ‘Windows 10’, os.arch: ‘amd64’, os.version: ‘10.0’, java.version: ‘1.8.0_181’
Driver info: com.kms.katalon.selenium.driver.CChromeDriver
Capabilities {acceptInsecureCerts: false, browserName: chrome, browserVersion: 105.0.5195.125, chrome: {chromedriverVersion: 104.0.5112.79 (3cf3e8c8a07d…, userDataDir: C:\Users\GISELE~1.ALB\AppDa…}, goog:chromeOptions: {debuggerAddress: localhost:50189}, javascriptEnabled: true, networkConnectionEnabled: false, pageLoadStrategy: normal, platform: WINDOWS, platformName: WINDOWS, proxy: Proxy(), setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify, webauthn:extension:credBlob: true, webauthn:extension:largeBlob: true, webauthn:virtualAuthenticators: true}
Session ID: efefd1b51bfbd669c2205d070498b6ed
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:187)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:122)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:49)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:158)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552)
at com.kms.katalon.selenium.driver.CChromeDriver.execute(CChromeDriver.java:19)
at org.openqa.selenium.remote.RemoteWebDriver.executeScript(RemoteWebDriver.java:489)
at org.openqa.selenium.support.events.EventFiringWebDriver.lambda$new$1(EventFiringWebDriver.java:105)
at com.sun.proxy.$Proxy8.executeScript(Unknown Source)
at org.openqa.selenium.support.events.EventFiringWebDriver.executeScript(EventFiringWebDriver.java:229)
at com.kms.katalon.core.webui.keyword.builtin.ExecuteJavaScriptKeyword$_executeJavascript_closure1.doCall(ExecuteJavascriptKeyword.groovy:48)
at com.kms.katalon.core.webui.keyword.builtin.ExecuteJavaScriptKeyword$_executeJavascript_closure1.call(ExecuteJavascriptKeyword.groovy)
at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.runKeyword(WebUIKeywordMain.groovy:20)
… 17 more
What I noticed is that if there are no values on the field and run that script on the console, the alert of the image above shows up. Now if I enter a value (no matter if it’s a valid code or not) and run that script, the button is clicked but the action stops, just as all the other methods I tried
It’s entirely possible the page (the application) is using JavaScript to perform specific actions based on current page state. It’s your task to find out what those actions might be (it’s impossible for me to know what they might be).
Hint: Try your best to make your test script mimic the actions of a user. Said another way, don’t do things a user cannot do.
Hi there! After investigating and digging into why the click didn’t work, I realized the computer’s time was a few minutes off and since I’m using an OTP generator for the login, that was the reason it was causing issues. When the code was being generated it didn’t match the time on the computer, after syncing the clock with windows servers the tests worked fine!
I would have never guessed that was messing with my tests. I appreciate the time you took into provinding solutions