I tried the solution provided there and change the links/objects accordingly to my situation:
// Wait upto 10 seconds for a_Accounts to be visible...
WebUI.waitForElementVisible(findTestObject('Local_OPP/Page_Home Salesforce/span_Opportunities'), 10)
// Wait an additional, full 10 seconds...
/* ****** */ WebUI.delay(10) /* ****** */
WebUI.executeJavaScript('''document.querySelector('a[href="/lightning/o/Opportunity/home"] > span').click()''', null)
// this was original solution from recording
// WebUI.click(findTestObject('Local_OPP/Page_Home Salesforce/span_Opportunities'))
But when I play the test case, error occurs:
10-08-2019 04:03:22 PM Test Cases/INTPack/New Opportunity object
Elapsed time: 25.214s
Test Cases/INTPack/New Opportunity object 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:56)
at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords.executeJavaScript(WebUiBuiltInKeywords.groovy:3787)
at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords$executeJavaScript$5.call(Unknown Source)
at New Opportunity object.run(New Opportunity object:34)
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 TempTestCase1570543399782.run(TempTestCase1570543399782.groovy:21)
Caused by: org.openqa.selenium.JavascriptException: javascript error: Cannot read property 'click' of null
(Session info: chrome=76.0.3809.132)
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'
System info: host: 'LTCZAEBS9RTMPQ2', ip: '10.46.3.13', 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: 76.0.3809.132, chrome: {chromedriverVersion: 76.0.3809.68 (420c9498db8ce..., userDataDir: C:\Users\LUKAS~1.RER\AppDat...}, goog:chromeOptions: {debuggerAddress: localhost:54800}, javascriptEnabled: true, networkConnectionEnabled: false, pageLoadStrategy: normal, platform: XP, platformName: XP, proxy: Proxy(), setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify}
Session ID: 6f6b6a4055d58518462a0c384bbbc367
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:20)
at org.openqa.selenium.remote.RemoteWebDriver.executeScript(RemoteWebDriver.java:489)
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
Ok, thought itās just a link, not an object. Iāll look into that during the day, still newbie, dunno where to find console
Just short update before I get back with results: original solution worked, when I used absolute XPath from ChroPath (both relative XPath and CSS fails).
Thanks, did not knew there was a console in this Tab. So the output of the JS code in console is only: ānullā. But thatās weird, in screen you can see exactly the same link.
So now you (we) need to prove that <a href=...> is residing inside the <iframe...> element.
Return to your DevTools, find the <a href=...> element and āwalkā up the tree until you find the <iframe> element. When you find it, take another screenshot - try to show both the iframe and the a-element in the same shot.
My intention is to build you some JS/CSS to reach the a-element. I need to see the entire āscopeā to do that.
No, no iframe tag found, until the top of this DevTool screen (until the beginning doctype html tag). I screened max of the code - I would paste whole, but did not found a way how to copy it from the DevTool. If itās just the html page I guess I can copy it from there.
Weird thing is, that when I used yesterday Katalon Recorder extension for Chrome, I did not have problem with this part. And second weird thing is, that this object is in the same menu, as the problem I linked in my first post.
I was just trying what will work, thatās how I found the absolute Xpath. But from what Iāve read, the absolute Xpath will probably crash with new SalesForce update.
So I am currently in my āPoCā stage - if it makes sense in our company to make the Katalon implementation bigger. If I fail on first scenario recording and will know that I will need to debug the tests with each update because of absolute Xpaths, the business case will suffer a blowā¦
Other question - can I somehow import the recording from Chrome extension to Katalon studio? I need to edit it because of the dynamic IDs on pop-up screens (Iāve read solution in another topic). But the problem is, I could not edit these things in the extension. And export seemed in kind of weird HTML filetypeā¦
Well, you shouldnāt allow my failure to help you judge the merits of Katalon Studio. Sitting in front of your PC, Iād very likely have this working in 5 minutes.
Letās try a callout to some other people - hopefully a fresh set of eyes will find something I missed.
@Russ_Thomas Donāt worry and thanks for help. I see Katalon as powerful tool, but the recording part has gaps, whatever the solution of this problem is.
In addition to what youāre doing for @devalex88, please try thisā¦
Run your stuff against Firefox and try the same things in the console. If you see any significant difference, weād like to see what those are. You can choose any of the console thingsā¦ doesnāt matter which ones.