Share
Go down
sunny mehndiratta
Regular Participant
Regular Participant
Posts : 25
Join date : 2013-03-22

Transfer the focus on pop up

on Thu Apr 04, 2013 2:19 pm
how can i transfer the focus to the newly opened pop up

i have used selectwindow but its not working there..

please help me out of the problem.

THANKS
ccox
Master
Master
Posts : 205
Join date : 2012-01-06
Age : 33
Location : Denver, CO

Re: Transfer the focus on pop up

on Thu Apr 04, 2013 11:33 pm
I will repost this for you again:

It sounds like your new window does not have an ID. When this happens, Selenium is creating a random name for that window. What does storeAllWindowNames return?
try:

storeAllWindowNames | windowNames
echo | ${windowNames}

storeAllWindowIds | windowIds
echo | ${windowIds}

storeAllWindowTitles | windowtitles
echo | ${windowtitles}

These are 3 different options to get the identifiers for this window. I believe these will store this in an array. Then you should be able to take the window's identifier as a variable from that array and select it. I've never done this before, but let me know what you get from these 3 echo commands.

-Cameron
sunny mehndiratta
Regular Participant
Regular Participant
Posts : 25
Join date : 2013-03-22

Re: Transfer the focus on pop up

on Mon Apr 08, 2013 11:46 am
i have used these commands its giving me window name like selenium_911234 but i m talking about pop up not window....OR both r same??????
ccox
Master
Master
Posts : 205
Join date : 2012-01-06
Age : 33
Location : Denver, CO

Re: Transfer the focus on pop up

on Mon Apr 08, 2013 9:47 pm
That IS the pop-up window. You are getting something back by doing these commands. Since it doesn't have a static defined id associated to it, you will need to store whatever Selenium gives you. Like I said, use the window's identifier as a variable and select it.

try:

storeAllWindowNames | windowName
selectWindow | ${windowName}
sunny mehndiratta
Regular Participant
Regular Participant
Posts : 25
Join date : 2013-03-22

Re: Transfer the focus on pop up

on Tue Apr 09, 2013 4:42 pm
will u please open icicilombard.com & go to chat button on the top of homepage... then fill ur details & then run with rc server,,,,, and then let me knw that u r able to take the focus on the chat window or not.......
ccox
Master
Master
Posts : 205
Join date : 2012-01-06
Age : 33
Location : Denver, CO

Re: Transfer the focus on pop up

on Tue Apr 09, 2013 9:53 pm
Code:
public void testPopUp() throws Exception {
      selenium.open("/");
      selenium.click("css=html");
      selenium.click("//img[@alt='Live Chat']");
      selenium.waitForPopUp("chat", "30000");
      selenium.selectWindow("title=Chat Window");
      Thread.sleep(1000);
      selenium.type("id=q1", "john");
   }

This works fine in Selenium IDE(This is posted in the IDE section of the forum). I don't use Selenium RC, but here is the code in JUnit4/RC if you want to give it a shot
sunny mehndiratta
Regular Participant
Regular Participant
Posts : 25
Join date : 2013-03-22

Re: Transfer the focus on pop up

on Wed Apr 10, 2013 11:38 am
i m also able to do it in selenium ide but in rc select window is not working... n focus is not going to the new popup.....bdw thanks for ur efforts
ccox
Master
Master
Posts : 205
Join date : 2012-01-06
Age : 33
Location : Denver, CO

Re: Transfer the focus on pop up

on Wed Apr 10, 2013 9:39 pm
Put in a pause before doing anything on the window. In the example you gave me, the pop-up does have a name and a title. In the examples you showed before this was not the case. If the pop up does not have a defined name/id you will need to use the window handles.

I would post/search in the RC forum if you can't figure it out since this is the IDE forum.
sathiyarengarajan
Active particpant
Active particpant
Posts : 20
Join date : 2013-08-08

Re: Transfer the focus on pop up

on Thu Aug 08, 2013 8:43 pm
Try with option
selectWindow()
Just provide the window title name withing ().
For Ex:
Window Title is Testing, then
command : selectWindow
title : TestingĀ 

To know the title of the newly opened window follow the steps:
Go to the new window
Right click->view page source
Press ctrl+F.
Type title and serch.
You will get the title of the new window
sathiyarengarajan
Active particpant
Active particpant
Posts : 20
Join date : 2013-08-08

Re: Transfer the focus on pop up

on Thu Aug 29, 2013 11:39 pm
Selenium IDE is a firefox plugin.
Firefox blocks the newly opening windows/tabs when you replay the scripts recorded in selenium IDE.
You should change the firefox settings to allow opening of new windows/tabs.
Hope this helps.

Thanks.
Sponsored content

Re: Transfer the focus on pop up

Back to top
Permissions in this forum:
You cannot reply to topics in this forum