I’m using the below Robot code to “clean” close the browser because the WebUI.close function doesn’t close browsers in such a way as to trigger certain web events on our site that fire as the user is closing the browser:
The problem is that since it’s just keypresses, if I have multiple windows open then it triggers those keypresses on whatever window I happen to be using at the time, is there a way to “point” the keypresses at the specific window that a given script is executing in?
Is the problem that you are multitasking ie running automation code alongside your other activities? If this is the case, I don’t see a Robot solution that wouldn’t interrupt you. Perhaps if you instead used Javascript to close the current tab? Eg
WebUI.executeJavaScript("window.close()
This may only work on an additional tab you opened though but please experiment
That’s what I’m curious about, is there an identifier that I can capture when I open the browser instance that I can use to “jump” back to that instance immediately before closing?
Katalon is able to track instances in order to perform the “Terminate running webdrivers” action from the Katalon Studio menu, wondering if there are some accessible trackers Katalon is using that I can tap into
There are a family of APIs like switchToWindowIndex() but I’m in favor of @Dan_Bown’s approach: use JavaScript. To me, that seems more direct than using any type of window handle. Hopefully that will work.
It appears that Dan’s comment has been able to help resolve your issue. Hence, we will close this thread up soon. Should you encounter any other issues, please ask the community by creating a thread on our forum
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.
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.