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
bhasker
Active particpant
Active particpant
Posts : 18
Join date : 2012-06-11

HOW TO HANDLE LOOKUP(NEW WINDOW ) IN SELENIUM Empty HOW TO HANDLE LOOKUP(NEW WINDOW ) IN SELENIUM

Tue Jul 17, 2012 7:06 pm
HI,
I got a issue whille selecting an element from lookup (new window).I tried to the window title but unable to retrieve the window tile(using get window handls method)
avatar
PonAruna
Posts : 5
Join date : 2012-07-06

HOW TO HANDLE LOOKUP(NEW WINDOW ) IN SELENIUM Empty Re: HOW TO HANDLE LOOKUP(NEW WINDOW ) IN SELENIUM

Wed Jul 18, 2012 1:29 am
try

dr1.switchTo().window("popupwindow");
("popupwindow" is the window name)
or

for (String handle : dr1.getWindowHandles()) {
dr1.switchTo().window(handle);
}
avatar
bhasker
Active particpant
Active particpant
Posts : 18
Join date : 2012-06-11

HOW TO HANDLE LOOKUP(NEW WINDOW ) IN SELENIUM Empty Re: HOW TO HANDLE LOOKUP(NEW WINDOW ) IN SELENIUM

Wed Jul 18, 2012 11:39 am
i tried in both ways but iam unable to switch to new window .is there any other method other these two
avatar
PonAruna
Posts : 5
Join date : 2012-07-06

HOW TO HANDLE LOOKUP(NEW WINDOW ) IN SELENIUM Empty Re: HOW TO HANDLE LOOKUP(NEW WINDOW ) IN SELENIUM

Wed Jul 18, 2012 9:17 pm
Hi

I believe you are trying this in either Selenium RC or webdriver

because either of this should work

I think you should try with some other example than with the one you are trying currently

give a try

import junit.framework.Assert;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;


public class PopupWindow {

public static void main(String[] args){

WebDriver dr1=new FirefoxDriver();
dr1.get("http://book.theautomatedtester.co.uk");
WebElement linkChapter1=dr1.findElement(By.linkText("Chapter1"));
linkChapter1.click();
System.out.println(dr1.getTitle());
WebElement multipleWindowLink = dr1.findElement(By.xpath(".//*[@id='multiplewindow']"));
multipleWindowLink.click();

// Accessing the window by window Name
http://dr1.switchTo().window("popupwindow");

// alternate method to access the popup window if the window name is not known
for (String handle : dr1.getWindowHandles()) {
dr1.switchTo().window(handle);
}
Assert.assertEquals(dr1.findElement(By.xpath("//*[@id='popuptext']")).getText(), "Text within the pop up window");

WebElement popupWindowClose = dr1.findElement(By.xpath("//*[@id='closepopup']"));
popupWindowClose.click();
for (String handle : dr1.getWindowHandles()) {
dr1.switchTo().window(handle);
}
System.out.println(dr1.getTitle());
dr1.quit();
}

}
avatar
popsha
Amateur
Amateur
Posts : 60
Join date : 2012-04-14

HOW TO HANDLE LOOKUP(NEW WINDOW ) IN SELENIUM Empty Re: HOW TO HANDLE LOOKUP(NEW WINDOW ) IN SELENIUM

Thu Jul 19, 2012 11:13 am
hope viewing this link would find a perfect solution for you.

https://seleniumforum.forumotion.net/t1298-how-to-switch-window-in-webdriver
Sponsored content

HOW TO HANDLE LOOKUP(NEW WINDOW ) IN SELENIUM Empty Re: HOW TO HANDLE LOOKUP(NEW WINDOW ) IN SELENIUM

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