Selenium Forum: Functional And Regression Testing Tool.
Would you like to react to this message? Create an account in a few clicks or log in to continue.
Search
Display results as :
Advanced Search
Latest topics
AEM Training | Free Online DemoWed Apr 21, 2021 5:45 pmazharuddin
c# PageFactory - issue initializing elementsFri Nov 01, 2019 8:40 pmthegoatboy
Selenium making automatic connection to random urlsMon Jul 08, 2019 12:58 pmrepairtechsolutions1
How can we design the custom framework in Selenium RCMon Jun 24, 2019 2:26 pmrandybonnettes
What are the new features in Selenium 3.0Tue Jun 18, 2019 5:37 pmpappyvicky
What are you using Selenium for? Fri Apr 12, 2019 3:52 amzhl
LIMITATIONS OF SELENIUMWed Apr 10, 2019 11:23 amswara
Navigation
 Portal
 Index
 Memberlist
 Profile
 FAQ
 Search

Go down
avatar
bgsraju
Posts : 3
Join date : 2010-11-17

How to get focus to main window after popup window is closed. Empty How to get focus to main window after popup window is closed.

Wed Nov 17, 2010 3:56 pm
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");
http://selenium.waitForPageToLoad("30000");
selenium.type("ctl00_txtMemberID", "001620682");
selenium.click("ctl00_btnmasterSearch");
http://selenium.waitForPageToLoad("30000");

selenium.click("ctl00_contentplaceholder1_uctMemberLedgerGrid1_btnNewLedger");
http://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]);
http://selenium.selectWindow("Add New Service Note");

selenium.type("ctl09_txtAmount", "100");
http://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);
http://selenium.close();
http://selenium.waitForPageToLoad("30000");



http://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.
avatar
SEtech
Posts : 4
Join date : 2010-04-09

How to get focus to main window after popup window is closed. Empty Re: How to get focus to main window after popup window is closed.

Thu Nov 18, 2010 1:48 pm
did you try

selenium.selectWindow(selenium.getAllWindowNames()[name1-1]);

instead of

selenium.selectWindow(null)?
Back to top
Permissions in this forum:
You cannot reply to topics in this forum