I am testing an application to test that must run in Selenium's single window mode. Multi window mode is not an option.
The problem is Selenium's frame takes a big chunk of the browser window.
How can I have the application frame expand to fill the browser window (and/or shrink the selenium part)?
Test code is in python.
Short of using Selenium.RunScript() to run some JavaScript code that adjusts the dimensions of each frame, you can't.
From the selenium API doc:
window_maximize(self, windowName)
Resize window to take up the entire screen
'windowName' is name of the window to be enlarged
Related
Currently, I'm running Selenium v4 locally on a normal PC with a graphics card and monitor. However, in production, I plan on running Selenium on a server that does not have a monitor.
When I call: driver.maximize() it maximizes the browser the the same height as the monitor/display. What behavior can I expect in production when the server does not have a display/monitor? How big will it maximize the window?
Update
I know you could run Selenium in headless mode but this is not my question. My question is how does Selenium/WebDriver maximize the size of the browser in this case, when it normally uses the size of the monitor/display to do so? What reference point is it using?
From the Resizing and positioning windows section of the WebDriver specification:
To maximize the window, given an operating system level window with an
associated top-level browsing context, run the implementation-specific
steps to transition the operating system level window into the
maximized window state. If the window manager supports window resizing
but does not have a concept of window maximization, the window
dimensions must be increased to the maximum available size permitted
by the window manager for the current screen. Return when the window
has completed the transition, or within an implementation-defined
timeout.
In short, executing Selenium based tests on a server that does not have a monitor using driver.maximize(), the command invokes the window manager-specific maximize operation, if any, on the window containing the current top-level browsing context. This typically increases the window to the maximum available size without going full-screen.
You could try using get_window_size to get the size of the maximized window in headless mode.
I have a test that opens a new window when the button is clicked but the window is not maximized. I switched to the current window and use the await t.maximizeWindow() but the target window still not maximized.
At the moment, support for multiple browser windows is a beta feature and has several limitations. So, you cannot resize child windows or take screenshots or videos of them.
You can find more information in the TestCafe documentation: https://devexpress.github.io/testcafe/documentation/guides/advanced-guides/multiple-browser-windows.html
I wanted to get drag and drop automated from a chromium-embedded window to another application/windows explorer window. Is it something that can be automated via Selenium or similar framework?
Roughly talking: Selenium works only inside web viewport.
If you want to drag and drop item from Chromium embedded-window to Windows Explorer window you can try White framework (if you are on Windows platform).
Introduction to White:
http://www.codeproject.com/Articles/289028/White-An-UI-Automation-tool-for-windows-applicatio
Discussion related "drag and drop" in White:
http://white.codeplex.com/discussions/271672
I'd go like this:
1. Use Selenium (ChromeDriver) to detect position of the item inside Chromium window.
2. Use desktop automation tool (like White, UI Automation or even call Windows API directly) to detect position of Chromium window.
3. Calculate absolute position of item (using data from first and second step).
4. Perform "drag and drop" using desktop automation tool (based on data from third step).
Is there a way to take a screenshot of JUST the browser window using Selenium RC? I am able to use the captureEntirePageScreenshot and the captureScreenshot methods but neither are what I want... My goal is to create screenshots, of a certain size, as the Selenium script runs and then be able to include those screenshots in a document. I know how to set the size of the browser window... so if there is a way to take a screenshot of ONLY the browser window, I'd have the images I need.
js gets downloaded to browser cache.
js contains functionA that constructs the url and calls the window.Open to open the url.
i call the functionA to open the window.
selenium doesnt detect the window at all. i did getAllWindowTitles and getAllWindowNames, etc. But do not see window at all.
by the way the reason i had to this is because when i click on button that has an onclick='calltofunction()', the window is not detected either.
it would be better actually if i can force selenium to see the open window after i click the button.
Thanks!
The straight forward answer that I can think of right now is to move on to Selenium 2.31.0, which has an updated support for WebDriver, and can be used in parallel to Selenium.
Then, it is easy to do ALT+TAB (for Windows, or CTRL+TAB for tabs), and WebDriver picks up the new tab/window and reads off of it.