How to get focus to main window after popup window is closed.
Page 1 of 1 • Share •
How to get focus to main window after popup window is closed.
Hi guys,
I am working on the popup window. I am able to focus on the popup
window and can enter the values in to the text fields and save the
values. After saving the value i am closing the window by clicking the
close button.The main page has to refresh automatically when the popup
window close. But my application is stuck after the popup window is
closed and throwing a warning message.Please go through the code
below.
public void testUntitled() throws Exception {
selenium.open("/Login.aspx");
selenium.type("txtUsername", "Raju");
selenium.type("txtPassword", "Raju");
selenium.click("btnSubmit");
//selenium.waitForPageToLoad("30000");
selenium.type("ctl00_txtMemberID", "001620682");
selenium.click("ctl00_btnmasterSearch");
//selenium.waitForPageToLoad("30000");
selenium.click("ctl00_contentplaceholder1_uctMemberLedgerGrid1_btnNewLedger");
//selenium.waitForPopUp("form1", "30000");
String[] name = selenium.getAllWindowNames();
int name1 = name.length-1;
System.out.println("WindowName : " +selenium.getAllWindowNames()
[name1]);
selenium.selectWindow(selenium.getAllWindowNames()[name1]);
//selenium.selectWindow("Add New Service Note");
selenium.type("ctl09_txtAmount", "100");
//selenium.select("ctl09_ddlLedgerStatus", "label=Refund Credited");
selenium.select("ctl09_ddlLedgerStatus", "label=Paid Confirmed");
selenium.select("ctl09_ddlCommission", "label=Commissioned");
selenium.type("ctl09_txtComments", "Commissioned");
selenium.click("ctl09_btnSave");
selenium.click("ctl09_btnClose");
selenium.selectWindow(null);
//selenium.close();
//selenium.waitForPageToLoad("30000");
//selenium.waitForPageToLoad("30000");
}
Error:
20:41:42.727 INFO - Got result: OK on session
20afc51bf7f04464b4d8472a08ea6ec2
20:41:42.743 INFO - Command request: selectWindow[null, ] on session
20afc51bf7f04464b4d8472a08ea6ec2
20:41:42.759 WARN - Invalid length: Content-Length=21395 written=16384
for http://nextindapp01:9010/Popup.aspx
can you guys please help me how to handle this?
Thanks in advance.
Regards,
Raju.
I am working on the popup window. I am able to focus on the popup
window and can enter the values in to the text fields and save the
values. After saving the value i am closing the window by clicking the
close button.The main page has to refresh automatically when the popup
window close. But my application is stuck after the popup window is
closed and throwing a warning message.Please go through the code
below.
public void testUntitled() throws Exception {
selenium.open("/Login.aspx");
selenium.type("txtUsername", "Raju");
selenium.type("txtPassword", "Raju");
selenium.click("btnSubmit");
//selenium.waitForPageToLoad("30000");
selenium.type("ctl00_txtMemberID", "001620682");
selenium.click("ctl00_btnmasterSearch");
//selenium.waitForPageToLoad("30000");
selenium.click("ctl00_contentplaceholder1_uctMemberLedgerGrid1_btnNewLedger");
//selenium.waitForPopUp("form1", "30000");
String[] name = selenium.getAllWindowNames();
int name1 = name.length-1;
System.out.println("WindowName : " +selenium.getAllWindowNames()
[name1]);
selenium.selectWindow(selenium.getAllWindowNames()[name1]);
//selenium.selectWindow("Add New Service Note");
selenium.type("ctl09_txtAmount", "100");
//selenium.select("ctl09_ddlLedgerStatus", "label=Refund Credited");
selenium.select("ctl09_ddlLedgerStatus", "label=Paid Confirmed");
selenium.select("ctl09_ddlCommission", "label=Commissioned");
selenium.type("ctl09_txtComments", "Commissioned");
selenium.click("ctl09_btnSave");
selenium.click("ctl09_btnClose");
selenium.selectWindow(null);
//selenium.close();
//selenium.waitForPageToLoad("30000");
//selenium.waitForPageToLoad("30000");
}
Error:
20:41:42.727 INFO - Got result: OK on session
20afc51bf7f04464b4d8472a08ea6ec2
20:41:42.743 INFO - Command request: selectWindow[null, ] on session
20afc51bf7f04464b4d8472a08ea6ec2
20:41:42.759 WARN - Invalid length: Content-Length=21395 written=16384
for http://nextindapp01:9010/Popup.aspx
can you guys please help me how to handle this?
Thanks in advance.
Regards,
Raju.
bgsraju- Posts: 3
Join date: 2010-11-17
Re: How to get focus to main window after popup window is closed.
did you try
selenium.selectWindow(selenium.getAllWindowNames()[name1-1]);
instead of
selenium.selectWindow(null)?
selenium.selectWindow(selenium.getAllWindowNames()[name1-1]);
instead of
selenium.selectWindow(null)?
SEtech- Posts: 4
Join date: 2010-04-09
Similar topics» HWK_Support_Suite_Setup_v02.10.000 - [UFSx HWK Box by SarasSoft (Main Setup)
» How to get focus to a new popup window which doesnt have name,id or unique title.
» How to get focus to main window after popup window is closed.
» Popup window for friends request
» How to shift the focus from one window to another window and proceed the action in Second window?
» How to get focus to a new popup window which doesnt have name,id or unique title.
» How to get focus to main window after popup window is closed.
» Popup window for friends request
» How to shift the focus from one window to another window and proceed the action in Second window?
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
» sample webdriver code for php users
» which standalone server to use
» Dynamic Drop Down Selection
» It is possible to find list of all URL's exist in any web page in selenium ide
» It is possible to compare 2 same images in selenium IDE.
» how to compare 2 ULR's which is exist in same web page (View page source).
» Web Driver: Unable to click a link present inside the frame of a frameset
» Help me to get dynamicaly loaded options of dropdown in Selenium RC -Junit test case