public bool SelectTopWindow()
{
try
{
string[] arr = GetAllWindowNames();
if (arr.Length != 0)
{
System.Threading.Thread.Sleep(1000);
_selObj.SelectWindow(arr.GetValue(arr.Length - 1).ToString());
return true;
}
}
catch (Exception exc)
{
return false;
}
}
Recomended:Open Source Automation framework
Monday, June 22, 2009
Subscribe to:
Post Comments (Atom)
Hi amit,
ReplyDeleteI have seen your posts and Thx for your posts...
I used below code and not working....I am using VS2010 IDE with C# code.
1) selenium.Click("css=input[id$='_LookupFooterImageButton']");
2) String feedWinId = selenium.GetEval("{var windowId; for(var x in selenium.browserbot.openedWindows ) {windowId=x;} }");
3) selenium.SelectWindow(feedWinId);
4) selenium.WindowFocus();
5) selenium.Type("//form[@id='form1']/table//*[@id='SearchTextBox']", "p");
Here while executing, selenium RemoteRunner executes line 1 which is going to open popup window and after that no response for long time..
So I closed that opened popup window manually while executing, Immediately lines 2,3 and 4 are executing....
Line 5 is the command to give input on popup window...
So whatever lines are there after the line which will open popup window are not executing. Also when i close popup manully, immediately excuting those lines.. so i can't get id or name of popup window to handle...
Can u help me on this? How i can pass input to Popup window....
Thx in advance,
SCSVEL
hy your post realy save me thanks from argentina and keep that way ;)
ReplyDeleteThank you! The code below works and it really really helped me.
ReplyDelete1) selenium.Click("css=input[id$='_LookupFooterImageButton']");
2) String feedWinId = selenium.GetEval("{var windowId; for(var x in selenium.browserbot.openedWindows ) {windowId=x;} }");
3) selenium.SelectWindow(feedWinId);
4) selenium.WindowFocus();
5) selenium.Type("//form[@id='form1']/table//*[@id='SearchTextBox']", "p");