Testcafe: How to maximize the window? - testing

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

Related

Open window such that is shows on all desktops

I have a screenshot thing, what it does is it takes a screenshot of the current visible stuff, then opens a full screen window covering everything. However this opens on the desktop of the parent window which is on desktop 1. And if a user had desktop 2 focused (due to like fullscreen app or something) then the window that opened will not show on desktop 2.
So I was wondering if there is a window level or something (I tried all the window levels) that will make it such that a window appears on all desktops.
Thanks
This sounds like either NSWindowCollectionBehaviorCanJoinAllSpaces or NSWindowCollectionBehaviorStationary. Set it as the collectionBehavior of the window.
(You probably want to set the window level, too, but that's about ordering rather than collection/Spaces behavior. And if you have a Window menu, then you probably also want NSWindowCollectionBehaviorIgnoresCycle.)

Windows 8 tablet - How to prevent explorer from starting desktop app with maximized window?

When I start a desktop application on Windows 8 tablet, Explorer starts it with SW_SHOWMAXIMIZED.
For example, if you start Notepad from command prompt, it opens in normal window size, but if you do that from Explorer, maximized window is opened. I have seen this Explorer behavior only on tablet PC and I guess Explorer is doing that on purpose.
I understand that it may be useful for many application programs, but I want my program to start with normal size unless user explicitly requests Explorer to open it maximized.
Is there a way to stop this for my application? I'm hoping that there is an API or manifest to do that, but I couldn't find any information at MSDN.
Thanks in advance.
See if this helps:
Open any program that is affected with this issue. Note: Make sure that it is the only open window of that program. eg. You can only do this if you have one window of command prompt open.
Adjust the window size and position to your liking.
While holding Ctrl on your keyboard, close the window by clicking (or touching, for tablet) the X in the top-right corner of the window to close it.
Re-open the program. Your window should now open in the way you set it in step 3.

Unable to switch among the windows

I am automating using selenium 2.0, my application launches the login page by default in a new window, hence my application has by default two windows. These two windows will remain open always. In this case I could switch between the windows without any problem. The below code is executed without any errors.
for(String winHandle : driver.getWindowHandles()){
driver.switchTo().window(winHandle);
}
The problem starts while clicking the menu options a pop up window launches to search the records. Here, I need to switch between these three windows. I tried the below piece of code. It returns only the first two window handles.
Set availableWindows = driver.getWindowHandles();
This popup window is coded in such a way that, "In a .jsp file it is parameterised as window.open()".
Please let me know, if some one could help me on this?
If you're only seeing 2 window in getWindowHandles(), then the popup is probably a iframe. In this event, use driver.switchTo().frame() to switch focus to that frame instead of looking for an entirely new window.
Here's the documentation on the switch method: http://selenium.googlecode.com/git/docs/api/java/org/openqa/selenium/WebDriver.html#switchTo()
One probable solution is to use JavascriptExecutor.executeScript() method to run a javascript code and handle the pop up window without switching into pop up window.
For example, from parent window of pop up window, run a javascript code which is something like this.
JavascriptExecutor exec = (JavascriptExecutor)driver;exec.executeScript("var popup = <<popupopener function>>; //operate on popup object to manipulate the markup of pop up window");

How to force selenium to detect open window?

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.

Selenium RC single window - how to maximize client frame

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