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

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