Search
 
 

Display results as :
 


Rechercher Advanced Search

Latest topics
» Regarding Alert Interface
Fri Feb 24, 2017 2:00 pm by karthikeyakumar

» Geting issues in identifying the elsements in webdriver
Fri Feb 17, 2017 4:41 pm by janbaskt

» WebDriver - why not to use a singlton for it?
Fri Feb 17, 2017 4:40 pm by janbaskt

» WebDriver session when using testng annotation to invoke driver instance
Fri Feb 17, 2017 4:39 pm by janbaskt

» Selenium fails to launch Chrome
Fri Feb 17, 2017 4:39 pm by janbaskt

» why do i get this error
Fri Feb 17, 2017 4:38 pm by janbaskt

» Selenium Tutorial
Thu Feb 16, 2017 5:21 pm by Rahul

» When to use Selenium IDE, RC and WebDriver
Mon Feb 13, 2017 2:35 pm by azharuddin

» How to integrate selenium with ZAPI-Zephyr
Sat Feb 11, 2017 2:25 am by gseera002c

Navigation
 Portal
 Index
 Memberlist
 Profile
 FAQ
 Search

HOW TO HANDLE LOOKUP(NEW WINDOW ) IN SELENIUM

View previous topic View next topic Go down

HOW TO HANDLE LOOKUP(NEW WINDOW ) IN SELENIUM

Post by bhasker on 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)

bhasker
Active particpant
Active particpant

Posts : 18
Join date : 2012-06-11

Back to top Go down

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

Post by PonAruna on 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);
}

PonAruna

Posts : 5
Join date : 2012-07-06

Back to top Go down

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

Post by bhasker on 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

bhasker
Active particpant
Active particpant

Posts : 18
Join date : 2012-06-11

Back to top Go down

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

Post by PonAruna on 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();
}

}

PonAruna

Posts : 5
Join date : 2012-07-06

Back to top Go down

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

Post by popsha on Thu Jul 19, 2012 11:13 am

hope viewing this link would find a perfect solution for you.

http://seleniumforum.forumotion.net/t1298-how-to-switch-window-in-webdriver

popsha
Amateur
Amateur

Posts : 60
Join date : 2012-04-14

Back to top Go down

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

Post by Sponsored content


Sponsored content


Back to top Go down

View previous topic View next topic Back to top

- Similar topics

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