Search
 
 

Display results as :
 


Rechercher Advanced Search

Latest topics
» how to connect DB in selenium webriver
Fri Oct 06, 2017 4:09 pm by anbarasi

» How find any text in browser screen and click on it?
Thu Oct 05, 2017 2:02 pm by sandeepkommineni

» Selenium Webdriver
Tue Oct 03, 2017 1:35 pm by PiyushBiswas

» GRID setup tutorial.
Wed Sep 27, 2017 4:29 pm by johnyapp

» Drag & Drop Between Windows Using Selenium Driver
Wed Sep 27, 2017 2:10 pm by 26rondel

» Check if window is closed / verify input
Sat Sep 23, 2017 10:21 pm by brainstir

» How to work on pages with AJAX in selenium?
Mon Sep 18, 2017 6:08 pm by azharuddin

» pause test until user press a key like F2
Wed Aug 09, 2017 11:10 pm by djnforce

» Selecting the input for auto populating element
Sat Jul 29, 2017 7:53 pm by kdabbara

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