Does Selenium require maximized browser window? - browser

I have not used Selenium myself, but I was wondering whether the browser window needs to be maximized during test execution? I have used some other tools where the mouse pointer does not find the correct HTML element if the window is too small.

Selenium 2.0 (WebDriver) automatically attempts to scroll an element into view when you're going to perform any action on this element. If it can't scroll it throws an exception. So, don't make your window too small, but there is no need to maximize it. Keep it "mid-size".
For the abovementioned reason, you may want to maximize the browser window to avoid excessive scrolling, that can cause some unnecesssary events on the page.
Sometimes Selenium (WebDriver) can't click an element if it is placed too close to the viewport border (half-visible). In this case you can try to tune the window size to make this element either totally visible, or totally invisible (to activate auto-scrolling).
If you use Selenium (WebDriver) with "native events" enabled, you'd better keep the browser window in foreground and in focus during test execution. No matter whether it is maximized or "mid-size" -- just don't minimize it!
If you're happy with "synthesized events" -- many chances for your tests to run successfully in foreground.

No, because Selenium uses the DOM Structure to act on and not the OS(mouse, windows and stuff). You can actually minimize your window during a test.

Maybe not maximized, but probably best to have test at set minimum and maximum size.
An idea would be to have selenium resize the window for you before it runs the tests... A quick search gave me this: https://makandracards.com/makandra/9773-how-to-start-selenium-browser-with-custom-window-size

Related

Is it possible to animate extension popup opening?

I developed a simple chrome extension. Following the answers in this SO post I was able to programmatically open the popup window on certain webpages. The default behavior of the popup is to open a window at the top right. Is it possible to modify this behavior? Ideally, I would like the popup window to slide in from the right after the automatic window.open is invoked in the background script.
No, you have no control over how and where it appears.
If you want something like slide-in, you're better off injecting your GUI elements into the page itself.
How feasible it is depends on whether you need to inject it into an arbitrary page or if you're working with just one specific website. Shadow DOM might help you isolate styles from the parent page.

Disabling minimize feature in qml

Is there a way to make a Qt window (qml with pyside2) to never minimize?
(Not the minimize button)
I'm trying to achieve something like conky (Linux) or rainmeter (Windows) with python 3 and qml (Qt).
I want a borderless window to stay on the back of the screen and stay there no matter what as if it's part of the wallpaper. Making the window borderless was achieved with the Qt.SplashScreen flag but disabling minimize turns out to be much harder than I initially thought. All the methods I've tried hides the window when win+D is pressed.

Electron: Is it possible to set the current window to be frameless?

I would like to be able to toggle between framed and frameless window in my Electron app, without needing to construct a new window. This is because this option is a different view than what would be initially loaded, therefore it would be nice if there is a way to change the current window to be frameless.
I have found window.setFullscreen() for toggling between full screen mode. I've not been able to find anything similar for frameless window. Is there any such method or workaround that I'm not seeing?
As the docs go, you enable or disable window frame at the time of creation of browser window. After that, there are no methods you can call to enable or disable frame. However, if you really really want that option, there may be a workaround. And a workaround, is well, a workaround.
Create 2 browser windows, one over the other. The first one being transparent window(with frame and click-through) and the second one being your content window(without frame).
Implement your custom solution to keep size and position of both the windows in sync. Use ipc to share data between the windows.
Toggle the visibility of the transparent browser window to show/hide frame.
Some relevant resources:
Creating frameless window : https://electronjs.org/docs/api/frameless-window#create-a-frameless-window
Creating transparent window : https://electronjs.org/docs/api/frameless-window#transparent-window

How to deactivate window in Qt

I am trying to create a dockable window in Qt (it sits taking 4px width at the edge of the screen, always on top and it slides out when you hover it). I have to use WindowFlag BypassX11WindowManager (in order to hide taskbar hint, disable moving/resizing/etc. from window manager). I use these flags:
Qt::FramelessWindowHint
Qt::CustomizeWindowHint
Qt::X11BypassWindowManagerHint
Qt::WindowStaysOnTopHint
When I need my dock to be activated, I use the activateWindow() method. However, I have no idea, how to deactivate it.
Is there a way I can force my window deactivate? Now I can do it only by clicking another window and then return to the one that was active before revealing dock.
You should be able to use ->hide() to simply hide it if you don't want it to appear at certain points.
I assume, by the way, you know there is QDockWidget/ class that may help you as well. It's unclear from the above if you're using it or not.

Opening a new browser page on the second monitor

Well, simple situation. Is it possible to detect if a user has a dual monitor setup from a web application?
If this is possible, is it possible to open a child browser page on this second monitor, so the new window doesn't overlap the old one?
Reason why I ask: I'm working on a web application and at home I have a dual-monitor system. When I go to the administration part of this site, I want it to open in a new browser, preferably on the other desktop. Of course, I could just click, then drag the new window, but doing this automatically seems more fun. :-)
Don't think JavaScript has the proper functions for this. How about Java itself?
I don't think you'll be able to directly detect a dual monitor setup, but you can probably make a good guess by looking at their screen resolution, using javascript's screen.width and screen.height. If the ratio of the width to the height is 8:3, its a good chance they have 2 standard 4:3 monitors side by side. You can do a similar calculation for 16:9 or 16:10.
Using maxpower47's suggestion about resolution, the only way to display the page on the other monitor would be to open a popup, and use the options to set the top, right, width and height properties so the window will appear on the second monitor in a decent size.
Here is a link that describes how to do this: http://www.netmechanic.com/news/vol4/javascript_no7.htm

Resources