Clicking tab once the page loads through katalon command

I am stuck in automating this test case

  1. Launch the browser and open application URL (e.g.
  2. Once page loads, hit the tab key and verify that the first element in focus is ‘xx’ element

I have used WebUI.sendKeys(findTestObject(‘Object location’), Keys.chord(Keys.TAB)) many times with success. But here I cannot focus on the URL and hit tab

Please help

1 Like

kindly share the error trace or screenshot


I suggest that you have:

  • waitForPageLoad() to make sure the page is loaded
  • you can try switchToWindow() to Switch focus to the browser window then sendKeys()
  • verify the focused element by getFocusedElement()
1 Like

What Object location can I put in SendKeys?

WebUI.sendKeys(findTestObject(‘Object location???’), Keys.chord(Keys.TAB))

No error as nothing is created. Need to know what to put in ‘Object Location’ for sendkeys


I found this example:

'Press Ctrl+A to select all text in txt_Comment'
WebUI.sendKeys(findTestObject('txt_Comment'), Keys.chord(Keys.CONTROL, 'a'))

Replace txt_Comment with your xx element

I like @Elly_Tran’s idea of using “switchToWindowIndex(1)”, and then return to the original page, “switchToDefaultContent()”, but I was not able to find any information on the method, getFocusedElement(). Otherwise, I think this would be the easiest way to go about your concern.

Doing something a user would never do is decidedly not cool. And loading another page/window and then switching between them? Terrible idea. Even if you get this to “work”, what is it testing? What does the result even mean? Answer: It works as long as you do weird things no one would ever do.

@hemant.mishra.extern have you tried the robot api?

import java.awt.Robot

If you can’t get that to work, let me know.

1 Like

Thanks for your response. It worked with the method mentioned by Russ!


Russ, you are awesome! It worked with this. Now it looks so simple

import java.awt.Robot

  1. loading website
  2. Robot robot = new Robot()
  3. next steps…

@hemant.mishra.extern Glad you got it to work. And thanks for the praise. :clap:


Hi everyone @here, :wave:

We would like to share with you that this thread has been chosen by our internal teams to be turned into a blog post on The Katalon Blog. We will share the link to the blog with you shortly.

We have condensed the thread into succinct and informative chunks of information that go over the issues faced by the OP (original poster) and many of the proposed workarounds from other members.

This way, it can help those who are considering using Katalon, or have never been on the forum before, to discover potential solutions from other Katalon users who may be having the same questions/issues as they are.

:pushpin: Note: These blog posts are not intended to offer readers a one-size-fits-all solution to their questions, as we are aware that different machine settings and configurations may lead to different results, but rather to foster further peer-to-peer discussions and collaboration.

Mistakes and inaccuracies are bound to happen with these blog posts. Hence, we encourage you to share your thoughts and feedack in Site Feedback.

Thanks & happy testing! :sunglasses:


Hi all,

Please find the link to the blog post below…

Mistakes and inaccuracies are bound to happen with these blog posts. Hence, we encourage you to share your thoughts and feedack in Site Feedback.

1 Like

That blog post completely misses the point of the chosen solution.