Maximize the browser window?

Asked by Rahul Misra

I know Sikuli does not have an inherent understanding of browser app, so whats the recommended way to maximize the browser window? Just capture the max button and click on it?

Also is there any difference/advantage working with browser window maximized vs the default open size? For eg for selenium browser maximization was a recommended practice.

Thanks
-R

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
Rahul Misra
Solved:
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

Maximizing the browser window when using Sikuli features usually does not make sense. The window size should be optimized to be able to restrict the searches to the content, you want to work with. so you can use App.window(), to get a base region, that represents this content.

If you for some reason need it maximized use the available key board shortcuts with type() (Chrome, Firefox, Safari, IE, .. have such a feature somewhere in their menus backed with a shortcut).

Another possibility (based on App.window()) is to resize the window by simulating mouse actions on the borders (can easily be implemented as a function to be reused in all cases).

Revision history for this message
Artem (masterzim-art) said :
#2

For Chrome you can use os.popen("path to chrome bin" + " --start-maximized")
I think you can google for command line flags for other browsers.

Revision history for this message
Rahul Misra (rmisra) said :
#3

Thanks guys. That was very insightful. Appreciate it. Keep up the awesome work!!!

Revision history for this message
Rajagopal (gopalcs1988) said :
#4

Hello,

I am using the below command to open the Chrome in incognito and maximized and got the below exception

os.popen("C:\Program Files (x86)\Google\Chrome\Application\chrome.exe -incognito" + "--start-maximized")

Exception:
[error] script [ wwe ] stopped with error at line --unknown--
[error] Error caused by: Traceback (most recent call last): File "C:\Genesys\Sikuli\wwe.sikuli\wwe.py", line 13, in <module> wait("1517483108515.png",5) File "C:\Users\rarumuga\Downloads\sikulix.jar\Lib\sikuli\Sikuli.py", line 65, in wait Line 2759, in file Region.java
at org.sikuli.script.Region.wait(Region.java:2759)
at sun.reflect.GeneratedMethodAccessor73.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
org.sikuli.script.FindFailed: FindFailed: 1517483108515.png: (153x38) seen at (759, 144) with 0.90 in S(0)[0,0 1920x1080] E:Y, T:3.0 Line 2759, in file Region.java

Revision history for this message
RaiMan (raimund-hocke) said :
#5

@Rajagopal
Before guessing around, you should read the docs and understand what you are doing.

FindFailed means that an image was not found with SikuliX find op.

Do not ask questions in comments to already solved question. No one else besides me will see it.
Post your own questions.