Close nth open window in IE11 using Selenium - selenium

On the page "http://www.seleniumframework.com/Practiceform/" There is a button "New Message Window".
I want to hit this button 5 times which will open 5 windows. All the windows have same content. So cant identify specific window using content
i want to close the 3rd window.

I'm only seeing this open the same window multiple times. However, if you want to do this, you would:
Get the current window handles
Switch to the third one
Send your webdriver instance the close command (not the quit command, that will close all windows)
Without knowing what language you're using, I won't be able to give you an example.

Related

Selenium IDE select window in loop?

I wrote a selenium script that will open a specific URL to then click on button at the index page. After that, a pop up window will show up. The script will click on a button inside this new pop up window, so i need to select that window in order to make a command on it.
So i did (select window) and give it the target (win_ser_1), which belongs to the pop up window and it clicked the button. After that it will select the previous index page (win_ser_local) and start over again and again until the loops end.
The problem is: when the selenium open a new pop up it gives it a target name like this (win_ser_1 ) and when it closes it and opens it again, the pop up will show with a different name (win_ser_2) although i closed the previews pop up before.
So it seems i need to give the select window a new value each time the selenium a open a pop up? If so, I will need to count how many times the script will open a pop up?! But i don't want this, so: is there a simple way fix this?
My commands:

Selenium test closing window dialog

I'm using Selenium with Robot Framework to write my GUI tests. One of the tests is verifying if, when the user clicks on the Close window/tab button (outside of the webpage), it triggers the alert box before exiting.
I've tried the keywords "Close window" and "Close browser", but both of them ignore the event and close the window. I also tried to close the window with javacript window.close();, but it doesn't work for windows that aren't opened with window.open(); - it is a security measure. I'm using Selenium Grid with different browsers on Linux and Windows, but everytime is failing. Is there a possibility to check this with selenium or I have to use other tools like AutoIT that automate any GUI, not only the browser?
After five days of searching for a solution, I didn't find one that tries to close the page/tab/window and triggers that alert confirmation box.
Instead, I found a workaround that is similar to that and also triggers the necessary alert which is captured by Selenium: click on a link, reopen the same page or go to another one. Like this:
Go To https://stackoverflow.com/
Handle Alert action=DISMISS
I put here action=DISMISS to simply continue with my test on the same page, but if there is need you can change it to something else.

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.

Selenium IDE unable to open new windows from link when running through testcase

So I'm writing tests for a web page, and one of the tests include clicking a link, which opens a new window, do some assertions in that window, and jump back.
To open links I'm using the technique described here.
The weird thing is, when I go through the steps manually (just press all of them one after another) it works fine. But when I try to run the whole test, it either does nothing (no windows open) or it clicks another button (and not the link).
What can be the reason for it working when i do the steps manually, and not when Selenium IDE runs them for me?
To open link, you can use
click | link=link name
selectWindow | windowname
And then perform operation on that window

is it possible to close MS Windows print pop up window using selenium

is it possible to close print pop up window using selenium..
Scenario is, on clicking print icon a pop up opens with preview and on top of it MS Windows Print pop up comes.
I could able to do validation in the preview window but unable to close the window because the presence of MS Windows print. SO this window always present in open state while executing other cases, i mean my cases are running but its blocking the view, almost half screen.
So i want to close the MS Windows Print pop-up and the i can close the preview window by selenium because it has 'Close' link
Computer Says No.
from the selenium cor faq :
...Currently there is not much that can be done about IE modal
dialogs.
I have a messy workaround right now that involves using AutoIT (http://www.autoitscript.com/site/autoit/) to just press alt + f4, I wrote a simple script, compiled it, and called it from my C# code, that I'm running on Selenium RC. I'm looking for a better way now since this is only a workaround, a quick fix allowing me to run it until I can write it in a cleaner way.
Code for AutoIT:
; Script Start
WinClose("Window Name")
C# Code
Process.Start("WindowClose.exe");