Hi,
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.
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))
WebUI.maximizeWindow()
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.
TIA
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.
TIA
â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,
Keller
@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:
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.
Thanks! I got it to work with this:
Imports:
import com.kms.katalon.core.webui.driver.DriverFactory as DriverFactory
import org.openqa.selenium.Point
Script:
WebDriver driver = DriverFactory.getWebDriver()
driver.manage().window().setPosition(new Point(-1900, 10))
WebUI.maximizeWindow()