I am not able to click on a web element in salesforce lightning application

Hi Umakant

I took the liberty of editing your post to make it easier to read. If you edit it yourself (without making any changes) you can learn how I made the changes to make it more readable.

I admit, I’m confused by the error message “Cannot read property ‘defaultView’ of undefined”. Researching this error I’m finding mostly jQuery links. However I did find one StackOverflow discussion relating to “Lightning Salesforce”. In include this here just because it seems to be related:

If that answer makes sense to you, then perhaps you need a delay after the login steps:

WebUI.setText(findTestObject('Object Repository/Page_Login Salesforce/input_Username_username'), 'usinha@locumtenens.com.umakantsb') WebUI.setEncryptedText(findTestObject('Object Repository/Page_Login Salesforce/input_Password_pw'), '1uMJd8mNtwqWmpEzPKuAUw==') WebUI.click(findTestObject('Object Repository/Page_Login Salesforce/input_Password_Login'))

// !!!Now wait for a_Accounts to be visible!!!

WebUI.click(findTestObject('Object Repository/Page_Home  Salesforce/a_Accounts'))

https://docs.katalon.com/katalon-studio/docs/webui-wait-for-element-visible.html#description

If that works, we can move on :slight_smile:

Aside:

If you want to simplify the attributes, use the CSS option and enter this in the text field:

a[href="/lightning/o/Account/home"] > span

Thanks for your response.

Like you mentioned to put a wait for a_Accounts to be visible, which method should i used for wait? Should i use “waitForElementClickable() method”.
please suggest.

// Wait upto 10 seconds for a_Accounts to be visible... 
WebUI.waitForElementVisible(findTestObject('Object Repository/Page_Home Salesforce/a_Accounts'), 10)

WebUI.click(findTestObject('Object Repository/Page_Home Salesforce/a_Accounts'))

Please let me know which method can i use in Katalon studio to wait for 10 sec. I am completely new to this tool.

When i do it using eclipse with java i use, Thread.sleep() or explicit wait.

What can i do here in Katalon Studio

I am sorry I got it. Didn’t read your post

Hi Russ,

I tried both the options:-

  1. Adding wait upto 10 seconds: the a_Accounts is visible but again fails on click action.

Here is the code:

 WebUI.openBrowser('')

WebUI.navigateToUrl('https://locumtenens--umakantsb.cs51.my.salesforce.com/')

WebUI.setText(findTestObject('Object Repository/Page_Login  Salesforce/input_Username_username'), 'usinha@locumtenens.com.umakantsb')

WebUI.setEncryptedText(findTestObject('Object Repository/Page_Login  Salesforce/input_Password_pw'), '1uMJd8mNtwqWmpEzPKuAUw==')

WebUI.click(findTestObject('Page_Login  Salesforce/input_Password_Login'))

WebUI.waitForElementVisible(findTestObject('Page_Home  Salesforce/a_Accounts'), 10)

WebUI.click(findTestObject('Page_Home  Salesforce/a_Accounts'))

WebUI.closeBrowser()

Here is the error:

SLF4J: The requested version 1.7.16 by your slf4j binding is not compatible with [1.6]
SLF4J: See http://www.slf4j.org/codes.html#version_mismatch for further details.
2019-04-04 11:34:49.943 INFO  c.k.katalon.core.main.TestCaseExecutor   - --------------------
2019-04-04 11:34:49.943 INFO  c.k.katalon.core.main.TestCaseExecutor   - START Test Cases/Account
2019-04-04 11:34:50.465 DEBUG testcase.Account                         - 1: openBrowser("")
2019-04-04 11:34:50.729 INFO  c.k.k.core.webui.driver.DriverFactory    - Starting 'Chrome' driver
2019-04-04 11:34:50.745 INFO  c.k.k.c.w.util.WebDriverPropertyUtil     - User set preference: ['args', '[--start-maximized, --disable-notifications]']
2019-04-04 11:34:50.770 INFO  c.k.k.core.webui.driver.DriverFactory    - Action delay is set to 0 seconds
Starting ChromeDriver 2.43.600210 (68dcf5eebde37173d4027fa8635e332711d2874a) on port 10739
Only local connections are allowed.
Apr 04, 2019 11:34:53 AM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: OSS
2019-04-04 11:34:53.904 INFO  c.k.k.core.webui.driver.DriverFactory    - sessionId = 70b7d5a1193f25e47cefb1073713a5f2
2019-04-04 11:34:53.936 INFO  c.k.k.core.webui.driver.DriverFactory    - browser = Chrome 73.0.3683.86
2019-04-04 11:34:53.937 INFO  c.k.k.core.webui.driver.DriverFactory    - platform = Windows 10
2019-04-04 11:34:53.939 INFO  c.k.k.core.webui.driver.DriverFactory    - seleniumVersion = 3.7.1
2019-04-04 11:34:53.941 INFO  c.k.k.core.webui.driver.DriverFactory    - proxyInformation = ProxyInformation{proxyOption=NO_PROXY, proxyServerType=HTTP, password=, proxyServerAddress=, proxyServerPort=0}
2019-04-04 11:34:53.943 DEBUG testcase.Account                         - 2: navigateToUrl("https://locumtenens--umakantsb.cs51.my.salesforce.com/")
2019-04-04 11:34:56.387 DEBUG testcase.Account                         - 3: setText(findTestObject("Object Repository/Page_Login  Salesforce/input_Username_username"), "usinha@locumtenens.com.umakantsb")
2019-04-04 11:34:56.988 DEBUG testcase.Account                         - 4: setEncryptedText(findTestObject("Object Repository/Page_Login  Salesforce/input_Password_pw"), "1uMJd8mNtwqWmpEzPKuAUw==")
2019-04-04 11:34:57.235 DEBUG testcase.Account                         - 5: click(findTestObject("Page_Login  Salesforce/input_Password_Login"))
2019-04-04 11:34:58.905 DEBUG testcase.Account                         - 6: waitForElementVisible(findTestObject("Page_Home  Salesforce/a_Accounts"), 10)
2019-04-04 11:35:03.120 DEBUG testcase.Account                         - 7: click(findTestObject("Page_Home  Salesforce/a_Accounts"))
2019-04-04 11:35:03.447 ERROR c.k.k.core.keyword.internal.KeywordMain  - ❌ Unable to click on object 'Object Repository/Page_Home  Salesforce/a_Accounts' (Root cause: com.kms.katalon.core.exception.StepFailedException: Unable to click on object 'Object Repository/Page_Home  Salesforce/a_Accounts'
	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.ClickKeyword.click(ClickKeyword.groovy:86)
	at com.kms.katalon.core.webui.keyword.builtin.ClickKeyword.execute(ClickKeyword.groovy:67)
	at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:56)
	at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords.click(WebUiBuiltInKeywords.groovy:616)
	at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords$click$3.call(Unknown Source)
	at Account.run(Account:29)
	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:331)
	at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:322)
	at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:301)
	at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:293)
	at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:227)
	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 TempTestCase1554392087934.run(TempTestCase1554392087934.groovy:21)
Caused by: org.openqa.selenium.WebDriverException: unknown error: Cannot read property 'defaultView' of undefined
  (Session info: chrome=73.0.3683.86)
  (Driver info: chromedriver=2.43.600210 (68dcf5eebde37173d4027fa8635e332711d2874a),platform=Windows NT 10.0.17134 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 0 milliseconds
Build info: version: '3.7.1', revision: '8a0099a', time: '2017-11-06T21:07:36.161Z'
System info: host: 'ATL-110665', ip: '10.30.14.178', 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, acceptSslCerts: false, applicationCacheEnabled: false, browserConnectionEnabled: false, browserName: chrome, chrome: {chromedriverVersion: 2.43.600210 (68dcf5eebde371..., userDataDir: C:\Users\usinha\AppData\Loc...}, cssSelectorsEnabled: true, databaseEnabled: false, goog:chromeOptions: {debuggerAddress: localhost:61823}, handlesAlerts: true, hasTouchScreen: false, javascriptEnabled: true, locationContextEnabled: true, mobileEmulationEnabled: false, nativeEvents: true, networkConnectionEnabled: false, pageLoadStrategy: normal, platform: XP, platformName: XP, rotatable: false, setWindowRect: true, takesHeapSnapshot: true, takesScreenshot: true, unexpectedAlertBehaviour: , unhandledPromptBehavior: , version: 73.0.3683.86, webStorageEnabled: true}
Session ID: 70b7d5a1193f25e47cefb1073713a5f2
	at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:214)
	at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:166)
	at org.openqa.selenium.remote.http.JsonHttpResponseCodec.reconstructValue(JsonHttpResponseCodec.java:40)
	at org.openqa.selenium.remote.http.AbstractHttpResponseCodec.decode(AbstractHttpResponseCodec.java:80)
	at org.openqa.selenium.remote.http.AbstractHttpResponseCodec.decode(AbstractHttpResponseCodec.java:44)
	at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:164)
	at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83)
	at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:600)
	at com.kms.katalon.selenium.driver.CChromeDriver.execute(CChromeDriver.java:20)
	at org.openqa.selenium.remote.RemoteWebElement.execute(RemoteWebElement.java:279)
	at org.openqa.selenium.remote.RemoteWebElement.click(RemoteWebElement.java:83)
	at com.kms.katalon.core.webui.keyword.builtin.ClickKeyword$_click_closure1.doCall(ClickKeyword.groovy:79)
	at com.kms.katalon.core.webui.keyword.builtin.ClickKeyword$_click_closure1.call(ClickKeyword.groovy)
	at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.runKeyword(WebUIKeywordMain.groovy:20)
	at com.kms.katalon.core.webui.keyword.builtin.ClickKeyword.click(ClickKeyword.groovy:86)
	at com.kms.katalon.core.webui.keyword.builtin.ClickKeyword.execute(ClickKeyword.groovy:67)
	at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:56)
	at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords.click(WebUiBuiltInKeywords.groovy:616)
	at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords$click$3.call(Unknown Source)
	at Script1554383633018.run(Script1554383633018.groovy:29)
	... 11 more
)
2019-04-04 11:35:03.451 ERROR c.k.katalon.core.main.TestCaseExecutor   - ❌ click(findTestObject("Page_Home  Salesforce/a_Accounts")) FAILED.
Reason:
com.kms.katalon.core.exception.StepFailedException: Unable to click on object 'Object Repository/Page_Home  Salesforce/a_Accounts'
	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.ClickKeyword.click(ClickKeyword.groovy:86)
	at com.kms.katalon.core.webui.keyword.builtin.ClickKeyword.execute(ClickKeyword.groovy:67)
	at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:56)
	at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords.click(WebUiBuiltInKeywords.groovy:616)
	at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords$click$3.call(Unknown Source)
	at Account.run(Account:29)
	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:331)
	at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:322)
	at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:301)
	at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:293)
	at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:227)
	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 TempTestCase1554392087934.run(TempTestCase1554392087934.groovy:21)
Caused by: org.openqa.selenium.WebDriverException: unknown error: Cannot read property 'defaultView' of undefined
  (Session info: chrome=73.0.3683.86)
  (Driver info: chromedriver=2.43.600210 (68dcf5eebde37173d4027fa8635e332711d2874a),platform=Windows NT 10.0.17134 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 0 milliseconds
Build info: version: '3.7.1', revision: '8a0099a', time: '2017-11-06T21:07:36.161Z'
System info: host: 'ATL-110665', ip: '10.30.14.178', 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, acceptSslCerts: false, applicationCacheEnabled: false, browserConnectionEnabled: false, browserName: chrome, chrome: {chromedriverVersion: 2.43.600210 (68dcf5eebde371..., userDataDir: C:\Users\usinha\AppData\Loc...}, cssSelectorsEnabled: true, databaseEnabled: false, goog:chromeOptions: {debuggerAddress: localhost:61823}, handlesAlerts: true, hasTouchScreen: false, javascriptEnabled: true, locationContextEnabled: true, mobileEmulationEnabled: false, nativeEvents: true, networkConnectionEnabled: false, pageLoadStrategy: normal, platform: XP, platformName: XP, rotatable: false, setWindowRect: true, takesHeapSnapshot: true, takesScreenshot: true, unexpectedAlertBehaviour: , unhandledPromptBehavior: , version: 73.0.3683.86, webStorageEnabled: true}
Session ID: 70b7d5a1193f25e47cefb1073713a5f2
	at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:214)
	at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:166)
	at org.openqa.selenium.remote.http.JsonHttpResponseCodec.reconstructValue(JsonHttpResponseCodec.java:40)
	at org.openqa.selenium.remote.http.AbstractHttpResponseCodec.decode(AbstractHttpResponseCodec.java:80)
	at org.openqa.selenium.remote.http.AbstractHttpResponseCodec.decode(AbstractHttpResponseCodec.java:44)
	at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:164)
	at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83)
	at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:600)
	at com.kms.katalon.selenium.driver.CChromeDriver.execute(CChromeDriver.java:20)
	at org.openqa.selenium.remote.RemoteWebElement.execute(RemoteWebElement.java:279)
	at org.openqa.selenium.remote.RemoteWebElement.click(RemoteWebElement.java:83)
	at com.kms.katalon.core.webui.keyword.builtin.ClickKeyword$_click_closure1.doCall(ClickKeyword.groovy:79)
	at com.kms.katalon.core.webui.keyword.builtin.ClickKeyword$_click_closure1.call(ClickKeyword.groovy)
	at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.runKeyword(WebUIKeywordMain.groovy:20)
	at com.kms.katalon.core.webui.keyword.builtin.ClickKeyword.click(ClickKeyword.groovy:86)
	at com.kms.katalon.core.webui.keyword.builtin.ClickKeyword.execute(ClickKeyword.groovy:67)
	at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:56)
	at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords.click(WebUiBuiltInKeywords.groovy:616)
	at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords$click$3.call(Unknown Source)
	at Script1554383633018.run(Script1554383633018.groovy:29)
	... 11 more

2019-04-04 11:35:03.452 ERROR c.k.katalon.core.main.TestCaseExecutor   - ❌ Test Cases/Account FAILED.
Reason:
com.kms.katalon.core.exception.StepFailedException: Unable to click on object 'Object Repository/Page_Home  Salesforce/a_Accounts'
	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.ClickKeyword.click(ClickKeyword.groovy:86)
	at com.kms.katalon.core.webui.keyword.builtin.ClickKeyword.execute(ClickKeyword.groovy:67)
	at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:56)
	at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords.click(WebUiBuiltInKeywords.groovy:616)
	at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords$click$3.call(Unknown Source)
	at Account.run(Account:29)
	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:331)
	at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:322)
	at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:301)
	at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:293)
	at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:227)
	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 TempTestCase1554392087934.run(TempTestCase1554392087934.groovy:21)
Caused by: org.openqa.selenium.WebDriverException: unknown error: Cannot read property 'defaultView' of undefined
  (Session info: chrome=73.0.3683.86)
  (Driver info: chromedriver=2.43.600210 (68dcf5eebde37173d4027fa8635e332711d2874a),platform=Windows NT 10.0.17134 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 0 milliseconds
Build info: version: '3.7.1', revision: '8a0099a', time: '2017-11-06T21:07:36.161Z'
System info: host: 'ATL-110665', ip: '10.30.14.178', 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, acceptSslCerts: false, applicationCacheEnabled: false, browserConnectionEnabled: false, browserName: chrome, chrome: {chromedriverVersion: 2.43.600210 (68dcf5eebde371..., userDataDir: C:\Users\usinha\AppData\Loc...}, cssSelectorsEnabled: true, databaseEnabled: false, goog:chromeOptions: {debuggerAddress: localhost:61823}, handlesAlerts: true, hasTouchScreen: false, javascriptEnabled: true, locationContextEnabled: true, mobileEmulationEnabled: false, nativeEvents: true, networkConnectionEnabled: false, pageLoadStrategy: normal, platform: XP, platformName: XP, rotatable: false, setWindowRect: true, takesHeapSnapshot: true, takesScreenshot: true, unexpectedAlertBehaviour: , unhandledPromptBehavior: , version: 73.0.3683.86, webStorageEnabled: true}
Session ID: 70b7d5a1193f25e47cefb1073713a5f2
	at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:214)
	at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:166)
	at org.openqa.selenium.remote.http.JsonHttpResponseCodec.reconstructValue(JsonHttpResponseCodec.java:40)
	at org.openqa.selenium.remote.http.AbstractHttpResponseCodec.decode(AbstractHttpResponseCodec.java:80)
	at org.openqa.selenium.remote.http.AbstractHttpResponseCodec.decode(AbstractHttpResponseCodec.java:44)
	at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:164)
	at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83)
	at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:600)
	at com.kms.katalon.selenium.driver.CChromeDriver.execute(CChromeDriver.java:20)
	at org.openqa.selenium.remote.RemoteWebElement.execute(RemoteWebElement.java:279)
	at org.openqa.selenium.remote.RemoteWebElement.click(RemoteWebElement.java:83)
	at com.kms.katalon.core.webui.keyword.builtin.ClickKeyword$_click_closure1.doCall(ClickKeyword.groovy:79)
	at com.kms.katalon.core.webui.keyword.builtin.ClickKeyword$_click_closure1.call(ClickKeyword.groovy)
	at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.runKeyword(WebUIKeywordMain.groovy:20)
	at com.kms.katalon.core.webui.keyword.builtin.ClickKeyword.click(ClickKeyword.groovy:86)
	at com.kms.katalon.core.webui.keyword.builtin.ClickKeyword.execute(ClickKeyword.groovy:67)
	at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:56)
	at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords.click(WebUiBuiltInKeywords.groovy:616)
	at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords$click$3.call(Unknown Source)
	at Script1554383633018.run(Script1554383633018.groovy:29)
	... 11 more

2019-04-04 11:35:03.460 INFO  c.k.katalon.core.main.TestCaseExecutor   - END Test Cases/Account

Understand what we are doing:

We are working through a series of steps to remove the error “Cannot read property ‘defaultView’ of undefined”. Once we’ve done that, then we can refine our approach. But we can’t do that until we’ve removed that error. I say that because I don’t want you to think, anything we “try” is how things will end up. Okay?

Now let’s be really silly… change the code like this:

// Wait upto 10 seconds for a_Accounts to be visible... 
WebUI.waitForElementVisible(findTestObject('Object Repository/Page_Home Salesforce/a_Accounts'), 10)

// Wait an additional, full 10 seconds...
/* ****** */ WebUI.delay(10) /* ****** */

WebUI.click(findTestObject('Object Repository/Page_Home Salesforce/a_Accounts'))

Obviously, forcing a fixed ten second delay is bad news. But let’s just see…

Also, for the time being, remove the WebUI.closeBrowser() at the end. Here’s why:

I want you to open the devtools in the browser (F12), go to the Console tab, and check to see if there are any errors posted there, after the test has completed.

I tried above steps like you mentioned that is forcing a fixed 10 sec delay and removing the WebUI.closeBrowser() at the end. But I am still getting the same issue:

Here is the new code after implementing suggested changes:

WebUI.openBrowser(‘’)

WebUI.navigateToUrl(‘https://locumtenens--umakantsb.cs51.my.salesforce.com/’)

WebUI.setText(findTestObject(‘Object Repository/Page_Login Salesforce/input_Username_username’), ‘usinha@locumtenens.com.umakantsb’)

WebUI.setEncryptedText(findTestObject(‘Object Repository/Page_Login Salesforce/input_Password_pw’), ‘1uMJd8mNtwqWmpEzPKuAUw==’)

WebUI.click(findTestObject(‘Page_Login Salesforce/input_Password_Login’))

WebUI.waitForElementVisible(findTestObject(‘Page_Home Salesforce/a_Accounts’), 10)

WebUI.delay(10)

WebUI.click(findTestObject(‘Page_Home Salesforce/a_Accounts’))

**

Here is the error again:

**
SLF4J: The requested version 1.7.16 by your slf4j binding is not compatible with [1.6]
SLF4J: See SLF4J Error Codes for further details.
2019-04-04 12:00:50.352 INFO c.k.katalon.core.main.TestCaseExecutor - --------------------
2019-04-04 12:00:50.352 INFO c.k.katalon.core.main.TestCaseExecutor - START Test Cases/Account
2019-04-04 12:00:50.911 DEBUG testcase.Account - 1: openBrowser(“”)
2019-04-04 12:00:51.254 INFO c.k.k.core.webui.driver.DriverFactory - Starting ‘Chrome’ driver
2019-04-04 12:00:51.269 INFO c.k.k.c.w.util.WebDriverPropertyUtil - User set preference: [‘args’, ‘[–start-maximized, --disable-notifications]’]
2019-04-04 12:00:51.288 INFO c.k.k.core.webui.driver.DriverFactory - Action delay is set to 0 seconds
Starting ChromeDriver 2.43.600210 (68dcf5eebde37173d4027fa8635e332711d2874a) on port 8589
Only local connections are allowed.
Apr 04, 2019 12:00:54 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: OSS
2019-04-04 12:00:54.433 INFO c.k.k.core.webui.driver.DriverFactory - sessionId = 99bb3a78897759be74b90eb5f48d1129
2019-04-04 12:00:54.462 INFO c.k.k.core.webui.driver.DriverFactory - browser = Chrome 73.0.3683.86
2019-04-04 12:00:54.463 INFO c.k.k.core.webui.driver.DriverFactory - platform = Windows 10
2019-04-04 12:00:54.466 INFO c.k.k.core.webui.driver.DriverFactory - seleniumVersion = 3.7.1
2019-04-04 12:00:54.468 INFO c.k.k.core.webui.driver.DriverFactory - proxyInformation = ProxyInformation{proxyOption=NO_PROXY, proxyServerType=HTTP, password=, proxyServerAddress=, proxyServerPort=0}
2019-04-04 12:00:54.470 DEBUG testcase.Account - 2: navigateToUrl(“https://locumtenens--umakantsb.cs51.my.salesforce.com/”)
2019-04-04 12:00:56.817 DEBUG testcase.Account - 3: setText(findTestObject(“Object Repository/Page_Login Salesforce/input_Username_username”), “usinha@locumtenens.com.umakantsb”)
2019-04-04 12:00:57.271 DEBUG testcase.Account - 4: setEncryptedText(findTestObject(“Object Repository/Page_Login Salesforce/input_Password_pw”), “1uMJd8mNtwqWmpEzPKuAUw==”)
2019-04-04 12:00:57.480 DEBUG testcase.Account - 5: click(findTestObject(“Page_Login Salesforce/input_Password_Login”))
2019-04-04 12:00:58.944 DEBUG testcase.Account - 6: waitForElementVisible(findTestObject(“Page_Home Salesforce/a_Accounts”), 10)
2019-04-04 12:01:06.876 DEBUG testcase.Account - 7: delay(10)
2019-04-04 12:01:16.893 DEBUG testcase.Account - 8: click(findTestObject(“Page_Home Salesforce/a_Accounts”))
2019-04-04 12:01:17.410 ERROR c.k.k.core.keyword.internal.KeywordMain - :x: Unable to click on object ‘Object Repository/Page_Home Salesforce/a_Accounts’ (Root cause: com.kms.katalon.core.exception.StepFailedException: Unable to click on object ‘Object Repository/Page_Home Salesforce/a_Accounts’
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.ClickKeyword.click(ClickKeyword.groovy:86)
at com.kms.katalon.core.webui.keyword.builtin.ClickKeyword.execute(ClickKeyword.groovy:67)
at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:56)
at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords.click(WebUiBuiltInKeywords.groovy:616)
at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords$click$3.call(Unknown Source)
at Account.run(Account:31)
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:331)
at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:322)
at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:301)
at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:293)
at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:227)
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 TempTestCase1554393647894.run(TempTestCase1554393647894.groovy:21)
Caused by: org.openqa.selenium.WebDriverException: unknown error: Cannot read property ‘defaultView’ of undefined
(Session info: chrome=73.0.3683.86)
(Driver info: chromedriver=2.43.600210 (68dcf5eebde37173d4027fa8635e332711d2874a),platform=Windows NT 10.0.17134 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 0 milliseconds
Build info: version: ‘3.7.1’, revision: ‘8a0099a’, time: ‘2017-11-06T21:07:36.161Z’
System info: host: ‘ATL-110665’, ip: ‘10.30.14.178’, 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, acceptSslCerts: false, applicationCacheEnabled: false, browserConnectionEnabled: false, browserName: chrome, chrome: {chromedriverVersion: 2.43.600210 (68dcf5eebde371…, userDataDir: C:\Users\usinha\AppData\Loc…}, cssSelectorsEnabled: true, databaseEnabled: false, goog:chromeOptions: {debuggerAddress: localhost:64028}, handlesAlerts: true, hasTouchScreen: false, javascriptEnabled: true, locationContextEnabled: true, mobileEmulationEnabled: false, nativeEvents: true, networkConnectionEnabled: false, pageLoadStrategy: normal, platform: XP, platformName: XP, rotatable: false, setWindowRect: true, takesHeapSnapshot: true, takesScreenshot: true, unexpectedAlertBehaviour: , unhandledPromptBehavior: , version: 73.0.3683.86, webStorageEnabled: true}
Session ID: 99bb3a78897759be74b90eb5f48d1129
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:214)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:166)
at org.openqa.selenium.remote.http.JsonHttpResponseCodec.reconstructValue(JsonHttpResponseCodec.java:40)
at org.openqa.selenium.remote.http.AbstractHttpResponseCodec.decode(AbstractHttpResponseCodec.java:80)
at org.openqa.selenium.remote.http.AbstractHttpResponseCodec.decode(AbstractHttpResponseCodec.java:44)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:164)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:600)
at com.kms.katalon.selenium.driver.CChromeDriver.execute(CChromeDriver.java:20)
at org.openqa.selenium.remote.RemoteWebElement.execute(RemoteWebElement.java:279)
at org.openqa.selenium.remote.RemoteWebElement.click(RemoteWebElement.java:83)
at com.kms.katalon.core.webui.keyword.builtin.ClickKeyword$_click_closure1.doCall(ClickKeyword.groovy:79)
at com.kms.katalon.core.webui.keyword.builtin.ClickKeyword$_click_closure1.call(ClickKeyword.groovy)
at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.runKeyword(WebUIKeywordMain.groovy:20)
at com.kms.katalon.core.webui.keyword.builtin.ClickKeyword.click(ClickKeyword.groovy:86)
at com.kms.katalon.core.webui.keyword.builtin.ClickKeyword.execute(ClickKeyword.groovy:67)
at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:56)
at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords.click(WebUiBuiltInKeywords.groovy:616)
at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords$click$3.call(Unknown Source)
at Script1554383633018.run(Script1554383633018.groovy:31)
… 11 more
)
2019-04-04 12:01:17.423 ERROR c.k.katalon.core.main.TestCaseExecutor - :x: click(findTestObject(“Page_Home Salesforce/a_Accounts”)) FAILED.
Reason:
com.kms.katalon.core.exception.StepFailedException: Unable to click on object ‘Object Repository/Page_Home Salesforce/a_Accounts’
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.ClickKeyword.click(ClickKeyword.groovy:86)
at com.kms.katalon.core.webui.keyword.builtin.ClickKeyword.execute(ClickKeyword.groovy:67)
at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:56)
at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords.click(WebUiBuiltInKeywords.groovy:616)
at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords$click$3.call(Unknown Source)
at Account.run(Account:31)
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:331)
at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:322)
at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:301)
at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:293)
at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:227)
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 TempTestCase1554393647894.run(TempTestCase1554393647894.groovy:21)
Caused by: org.openqa.selenium.WebDriverException: unknown error: Cannot read property ‘defaultView’ of undefined
(Session info: chrome=73.0.3683.86)
(Driver info: chromedriver=2.43.600210 (68dcf5eebde37173d4027fa8635e332711d2874a),platform=Windows NT 10.0.17134 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 0 milliseconds
Build info: version: ‘3.7.1’, revision: ‘8a0099a’, time: ‘2017-11-06T21:07:36.161Z’
System info: host: ‘ATL-110665’, ip: ‘10.30.14.178’, 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, acceptSslCerts: false, applicationCacheEnabled: false, browserConnectionEnabled: false, browserName: chrome, chrome: {chromedriverVersion: 2.43.600210 (68dcf5eebde371…, userDataDir: C:\Users\usinha\AppData\Loc…}, cssSelectorsEnabled: true, databaseEnabled: false, goog:chromeOptions: {debuggerAddress: localhost:64028}, handlesAlerts: true, hasTouchScreen: false, javascriptEnabled: true, locationContextEnabled: true, mobileEmulationEnabled: false, nativeEvents: true, networkConnectionEnabled: false, pageLoadStrategy: normal, platform: XP, platformName: XP, rotatable: false, setWindowRect: true, takesHeapSnapshot: true, takesScreenshot: true, unexpectedAlertBehaviour: , unhandledPromptBehavior: , version: 73.0.3683.86, webStorageEnabled: true}
Session ID: 99bb3a78897759be74b90eb5f48d1129
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:214)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:166)
at org.openqa.selenium.remote.http.JsonHttpResponseCodec.reconstructValue(JsonHttpResponseCodec.java:40)
at org.openqa.selenium.remote.http.AbstractHttpResponseCodec.decode(AbstractHttpResponseCodec.java:80)
at org.openqa.selenium.remote.http.AbstractHttpResponseCodec.decode(AbstractHttpResponseCodec.java:44)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:164)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:600)
at com.kms.katalon.selenium.driver.CChromeDriver.execute(CChromeDriver.java:20)
at org.openqa.selenium.remote.RemoteWebElement.execute(RemoteWebElement.java:279)
at org.openqa.selenium.remote.RemoteWebElement.click(RemoteWebElement.java:83)
at com.kms.katalon.core.webui.keyword.builtin.ClickKeyword$_click_closure1.doCall(ClickKeyword.groovy:79)
at com.kms.katalon.core.webui.keyword.builtin.ClickKeyword$_click_closure1.call(ClickKeyword.groovy)
at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.runKeyword(WebUIKeywordMain.groovy:20)
at com.kms.katalon.core.webui.keyword.builtin.ClickKeyword.click(ClickKeyword.groovy:86)
at com.kms.katalon.core.webui.keyword.builtin.ClickKeyword.execute(ClickKeyword.groovy:67)
at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:56)
at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords.click(WebUiBuiltInKeywords.groovy:616)
at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords$click$3.call(Unknown Source)
at Script1554383633018.run(Script1554383633018.groovy:31)
… 11 more

2019-04-04 12:01:17.429 ERROR c.k.katalon.core.main.TestCaseExecutor - :x: Test Cases/Account FAILED.
Reason:
com.kms.katalon.core.exception.StepFailedException: Unable to click on object ‘Object Repository/Page_Home Salesforce/a_Accounts’
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.ClickKeyword.click(ClickKeyword.groovy:86)
at com.kms.katalon.core.webui.keyword.builtin.ClickKeyword.execute(ClickKeyword.groovy:67)
at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:56)
at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords.click(WebUiBuiltInKeywords.groovy:616)
at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords$click$3.call(Unknown Source)
at Account.run(Account:31)
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:331)
at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:322)
at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:301)
at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:293)
at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:227)
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 TempTestCase1554393647894.run(TempTestCase1554393647894.groovy:21)
Caused by: org.openqa.selenium.WebDriverException: unknown error: Cannot read property ‘defaultView’ of undefined
(Session info: chrome=73.0.3683.86)
(Driver info: chromedriver=2.43.600210 (68dcf5eebde37173d4027fa8635e332711d2874a),platform=Windows NT 10.0.17134 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 0 milliseconds
Build info: version: ‘3.7.1’, revision: ‘8a0099a’, time: ‘2017-11-06T21:07:36.161Z’
System info: host: ‘ATL-110665’, ip: ‘10.30.14.178’, 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, acceptSslCerts: false, applicationCacheEnabled: false, browserConnectionEnabled: false, browserName: chrome, chrome: {chromedriverVersion: 2.43.600210 (68dcf5eebde371…, userDataDir: C:\Users\usinha\AppData\Loc…}, cssSelectorsEnabled: true, databaseEnabled: false, goog:chromeOptions: {debuggerAddress: localhost:64028}, handlesAlerts: true, hasTouchScreen: false, javascriptEnabled: true, locationContextEnabled: true, mobileEmulationEnabled: false, nativeEvents: true, networkConnectionEnabled: false, pageLoadStrategy: normal, platform: XP, platformName: XP, rotatable: false, setWindowRect: true, takesHeapSnapshot: true, takesScreenshot: true, unexpectedAlertBehaviour: , unhandledPromptBehavior: , version: 73.0.3683.86, webStorageEnabled: true}
Session ID: 99bb3a78897759be74b90eb5f48d1129
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:214)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:166)
at org.openqa.selenium.remote.http.JsonHttpResponseCodec.reconstructValue(JsonHttpResponseCodec.java:40)
at org.openqa.selenium.remote.http.AbstractHttpResponseCodec.decode(AbstractHttpResponseCodec.java:80)
at org.openqa.selenium.remote.http.AbstractHttpResponseCodec.decode(AbstractHttpResponseCodec.java:44)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:164)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:600)
at com.kms.katalon.selenium.driver.CChromeDriver.execute(CChromeDriver.java:20)
at org.openqa.selenium.remote.RemoteWebElement.execute(RemoteWebElement.java:279)
at org.openqa.selenium.remote.RemoteWebElement.click(RemoteWebElement.java:83)
at com.kms.katalon.core.webui.keyword.builtin.ClickKeyword$_click_closure1.doCall(ClickKeyword.groovy:79)
at com.kms.katalon.core.webui.keyword.builtin.ClickKeyword$_click_closure1.call(ClickKeyword.groovy)
at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.runKeyword(WebUIKeywordMain.groovy:20)
at com.kms.katalon.core.webui.keyword.builtin.ClickKeyword.click(ClickKeyword.groovy:86)
at com.kms.katalon.core.webui.keyword.builtin.ClickKeyword.execute(ClickKeyword.groovy:67)
at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:56)
at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords.click(WebUiBuiltInKeywords.groovy:616)
at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords$click$3.call(Unknown Source)
at Script1554383633018.run(Script1554383633018.groovy:31)
… 11 more

2019-04-04 12:01:17.431 INFO c.k.katalon.core.main.TestCaseExecutor - END Test Cases/Account

Please suggest what can we try next?

What are the properties for a_Accounts?

Did you check the browser console for errors?

What happens when you paste this line in the console and hit the Return key?

document.querySelector('a[href="/lightning/o/Account/home"] > span').click()

Did you check the browser console for errors? — Yes

What happens when you paste this line in the console and hit the Return key? ---- I get the following error

document.querySelector(‘a[href=“/lightning/o/Account/home”] > span’).click()
undefined.

Here is a screencapture of it:
image

That is not an error. It just means click() returns no value, hence undefined.

The point of the code in the console was to check if clicking the span element which resides inside the a_Account element actually works. So… did it?

Yes it did click it.

1 Like

Now try this:

// Wait upto 10 seconds for a_Accounts to be visible... 
WebUI.waitForElementVisible(findTestObject('Object Repository/Page_Home Salesforce/a_Accounts'), 10)

WebUI.delay(2)

WebUI.executeJavaScript('''
document.querySelector('a[href="/lightning/o/Account/home"] > span').click()
''', null)

If that works, you can try removing WebUI.delay(2).

2 Likes

Thanks Russ, this works.

And it also works after removing the WebUI.delay(2).

Really appreciate all your help !!!

One last question, how do we decide when to run the executeJavaScript()

1 Like

Cool.

I dunno… anytime Katalon/WebDriver isn’t playing fair? There’s something odd going on and I failed to find it. As I mentioned on another thread a while ago, if the gatekeepers won’t let you through the gate, jump over the fence :wink: Really, that’s all I did, “found another way in”.

The evidence that something strange is going on is that removing the delay still lets it work. This implies it’s not entirely down to a timing issue.

Confession: I rarely use WebUI to “do stuff”. Upwards of 99% of my actions are performed using calls to JavaScript. As much as I’d like to figure out what the issue truly was, I don’t have time to dick around with flaky webdriver issues so I go the JS route. I could have told you to try this in one of my earlier response, but I understand that most people prefer to use the “off the shelf” Katalon WebUI code.

Thanks again Russ for providing the details.

Where can i find more details about JS to be used in Katalon, I find it really interesting.

1 Like

That’s a very broad question… so forgive me if I give you a broad answer :slight_smile:

First, learn to write your own keywords. Once you’ve done that, you’ll know how to produce JS calls that work directly from your Test Script. Once you have that, testing will suddenly become a LOT easier.

When you read this stuff, understand you DO NOT need to add @Keyword above every method you write. You only need @Keyword if you use Manual View in Katalon and wish to select your keywords from the dropdown. You clearly don’t need that - you’re writing script just fine. You only need to learn about writing your own packages > classes > methods. That’s it. Here’s the link:

https://docs.katalon.com/katalon-studio/docs/introduction-to-custom-keywords.html

Now you can write your JS in a method like this:

void jsClicker(String selector) {
  String js = '''
    var selector = arguments[0];
    document.querySelector(selector).click()
  '''
  WebUI.executeJavaScript(js, Arrays.asList(selector))
}

and call it from your script like this:

jsClicker('a[href="/lightning/o/Account/home"] > span')

Thanks a lot :slight_smile:

Really appreciate all your help!!!

2 Likes