Open in 2nd monitor

I use 2 monitors for work. Is it possible that I see Katalon Studio in the 1st monitor and if I run a test case it opens in the 2nd monitor? Now I move browser window manually.

1 Like

Not directly, no. However, you can use the following code (use it after your call to openBrowser).

    WebDriver driver = DriverFactory.getWebDriver()
    driver.manage().window().setPosition(new Point(2000, 10))

You may need to adjust the 2000 to a suitable coordinate that works on your system.

You may need this import:

import com.kms.katalon.core.webui.driver.DriverFactory as DriverFactory

Hope this helps.


Hello Russ,

When using the script I am facing the following error-

org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
file:/E:/mypc/0.2.%20Automation/Katalon/RGS/Scripts/UnimelbStaging/Script1573717584884.groovy: 10: unable to resolve class WebDriver
@ line 10, column 11.
WebDriver driver = DriverFactory.getWebDriver()

file:/E:/mypc/0.2.%20Automation/Katalon/RGS/Scripts/UnimelbStaging/Script1573717584884.groovy: 11: unable to resolve class Point
@ line 11, column 38.
driver.manage().window().setPosition(new Point(2000, 10))

I copied and pasted the import script as well. Please help.


Yeah, sorry, there are a few more. Here is most of my Browser class:


Hello Russ,

Thank you for the feedback. Could you please give a screenshot of how it appears in the manual mode? I recorded the steps in Groovy and I haven’t yet learned to change it into java (if it is possible). So may be I could see your manual view and work on the changes accordingly.


"it" ? That is a groovy class, not a Test Case. It does not have a representation in Manual view.

lol, why would you send an image and not the code snippet you made???

About as useful as, “Oh I solved it” then disappearing

I did. You’re blind and/or your screen reader is faulty.

Can I have half an ounce of whatever it is you’re smoking? Seems like some good shit if it can alter reality to that degree.

Helen Keller Responds: Then enlighten me wizard of the class writing, where is snippet. Send an image of exactly on this vast page I can find it.

Not the command to run script. The class you wrote.

Fond Regards,

@rtetrault what is relevant for this topic is already provided in the code snippet (missing one import, WebDriver, but one with eyes can figure it out).
It can be used in the testcase or in a custom class, up to you.

Why do you need the entire class? found some other goodies there and lazy to write your own?

Hi @Russ_Thomas
I have a quick question…
Only if the user’s desktop is extended, I want to setPosition. Otherwise open the browser normally.
How to achieve this?

Good question. I don’t have an answer.

There are certainly no web APIs (no dom interfaces, to be more formal) to find out that kind of information. And if it’s not available there, I don’t see a way to get it from JavaScript or Groovy. On the other hand, there’s no reason Selenium couldn’t find out and make it available, but I’ve never heard of it.

Aside: It’s interesting that over the weekend I was looking at doing something in the browser (unrelated to testing) where I wanted to stretch the browser across three physical screens. Within the browser I wanted to demark three areas relating to the three screens but soon realized there was no way to know what the physical monitor setup was (e.g. user could have 2 superwide screens and my code would never know but would still work as though there were 3 logical areas to work with.)

In the end I changed most of my CSS to use “px” values instead of “vh” and “vw” which was a surprise in the sense that logical settings like vh are usually the way to go.

Anyway, here are the searches I tried - maybe I missed something:

1 Like

You may call it lazy, I call it ‘sharing’. Isn’t that what the community is about.
Who cares who wrote what. Do you or OP need internet pats on the back?

pat pat

I was looking to get the class because I am busy, still learning and see that the class has some interesting parts to it. I don’t see the answer to the original question outside of the class. Even the original poster was lost when trying to implement the answer given. Albeit because she was trying to implement the answer in manual mode. Even with that the code given that is copyable doesn’t seem to provide the solution as far as I can tell.

That is why I asked for a copyable instance of class. I have zero time to hand type from an image.
At this point I don’t need any of it. I’ve moved on.

You asked no such thing.

But all the time in the world to lambast with aggressive retorts designed to rankle? I see. 30-odd lines of code, 13 of which are blank or comments. Yep, that adds up. “Sharing” in a “community” is done between those that give and take, I find. You might want to consider a different approach - you might get better results.

If you feel bound to respond, do it via PM.

Those few lines of code is everything you need, related to the current post.
If you are too busy to learn how to use them in a script or in a class, perhaps AQA is not for you.

1 Like

Thanks! I got it to work with this:

import com.kms.katalon.core.webui.driver.DriverFactory as DriverFactory
import org.openqa.selenium.Point

WebDriver driver = DriverFactory.getWebDriver()
driver.manage().window().setPosition(new Point(-1900, 10))