Hi,

Am using Webdriver wait for explicity wait for element inside the popup
using xpath. its not working out.

*Code snippet:*
//Transferring the control to pop
Set s=driver.getWindowHandles();
Iterator ite=s.iterator();

while(ite.hasNext())

{

String popupHandle=ite.next().toString();

String mwh="WebServices";
if(!popupHandle.contains(mwh))

{

driver.switchTo().window(popupHandle);
System.out.println("Hello");
WebDriverWait wait=new WebDriverWait(driver,20);
//Waiting for tab inside the popup
WebElement element =
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//li[2]/a[2]/em/span/span")));
driver.findElement(By.xpath("//li[2]/a[2]/em/span/span")).click();
//
driver.findElement(By.xpath("//li[3]/a[2]/em/span/span")).click();
driver.findElement(By.xpath("//li[4]/a[2]/em/span/span")).click();
driver.findElement(By.xpath("//li[5]/a[2]/em/span/span")).click();
driver.findElement(By.xpath("//li[6]/a[2]/em/span/span")).click();
driver.findElement(By.xpath("//li[7]/a[2]/em/span/span")).click();
driver.findElement(By.xpath("//li[8]/a[2]/em/span/span")).click();
driver.findElement(By.xpath("//li[9]/a[2]/em/span/span")).click();
driver.findElement(By.xpath("//li[10]/a[2]/em/span/span")).click();
driver.findElement(By.xpath("//li[11]/a[2]/em/span/span")).click();
driver.findElement(By.xpath("//li[12]/a[2]/em/span/span")).click();

//here you can perform operation in pop-up window**

//After finished your operation in pop-up just select the main
window again
System.out.println("World");
driver.close();
driver.switchTo().window(mwh);

}

}

The Stack trace is as follows.

org.openqa.selenium.TimeoutException: Timed out after 20 seconds waiting
for visibility of element located by By.xpath: //li[2]/a[2]/em/span/span
Build info: version: '2.21.0', revision: '16552', time: '2012-04-11
19:09:00'
System info: os.name: 'Windows XP', os.arch: 'x86', os.version: '5.1',
java.version: '1.6.0_33'
Driver info: driver.version: FieldedSearchDriver
at
org.openqa.selenium.support.ui.FluentWait.timeoutException(FluentWait.java:252)
at org.openqa.selenium.support.ui.FluentWait.until(FluentWait.java:221)
at scripts.FieldedSearchDriver.login(FieldedSearchDriver.java:95)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at
org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:80)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:702)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:894)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1219)
at
org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)
at org.testng.TestRunner.privateRun(TestRunner.java:768)
at org.testng.TestRunner.run(TestRunner.java:617)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)
at org.testng.SuiteRunner.run(SuiteRunner.java:240)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:53)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:87)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1185)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1110)
at org.testng.TestNG.run(TestNG.java:1022)
at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:109)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:202)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:173)
Caused by: org.openqa.selenium.NoSuchElementException: Unable to find
element with xpath == //li[2]/a[2]/em/span/span (WARNING: The server did
not provide any stacktrace information)
Command duration or timeout: 30.62 seconds
For documentation on this error, please visit:
http://seleniumhq.org/exceptions/no_such_element.html
Build info: version: '2.21.0', revision: '16552', time: '2012-04-11
19:09:00'
System info: os.name: 'Windows XP', os.arch: 'x86', os.version: '5.1',
java.version: '1.6.0_33'
Driver info: driver.version: FieldedSearchDriver
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown
Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at
org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:175)
at
org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:128)
at
org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:459)
at
org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:227)
at
org.openqa.selenium.remote.RemoteWebDriver.findElementByXPath(RemoteWebDriver.java:312)
at org.openqa.selenium.By$ByXPath.findElement(By.java:344)
at
org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:219)
at
org.openqa.selenium.support.ui.ExpectedConditions.findElement(ExpectedConditions.java:421)
at
org.openqa.selenium.support.ui.ExpectedConditions.access$0(ExpectedConditions.java:419)
at
org.openqa.selenium.support.ui.ExpectedConditions$4.apply(ExpectedConditions.java:121)
at
org.openqa.selenium.support.ui.ExpectedConditions$4.apply(ExpectedConditions.java:1)
at org.openqa.selenium.support.ui.FluentWait.until(FluentWait.java:201)
... 25 more


--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To post to this group, send email to selenium-users@googlegroups.com.
To unsubscribe from this group, send email to selenium-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/selenium-users/-/kBekZkcEYQEJ.
For more options, visit https://groups.google.com/groups/opt_out.

Search Discussions

  • Peter Gale at Sep 7, 2012 at 4:29 pm
    Popup windows do not usually contain html.

    I'd suggest showing us the html of the page from which the popup is initiated.

    Also screen shots of the page before and after the popup is displayed.


    Date: Fri, 7 Sep 2012 06:59:40 -0700
    From: jacob.abraham@photoninfotech.net
    To: selenium-users@googlegroups.com
    Subject: [selenium-users] Popup window Wait

    Hi,

    Am using Webdriver wait for explicity wait for element inside the popup using xpath. its not working out.

    Code snippet:
    //Transferring the control to pop
    Set s=driver.getWindowHandles();
    Iterator ite=s.iterator();

    while(ite.hasNext())

    {

    String popupHandle=ite.next().toString();

    String mwh="WebServices";
    if(!popupHandle.contains(mwh))

    {

    driver.switchTo().window(popupHandle);
    System.out.println("Hello");
    WebDriverWait wait=new WebDriverWait(driver,20);
    //Waiting for tab inside the popup
    WebElement element = wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//li[2]/a[2]/em/span/span")));
    driver.findElement(By.xpath("//li[2]/a[2]/em/span/span")).click();
    //
    driver.findElement(By.xpath("//li[3]/a[2]/em/span/span")).click();
    driver.findElement(By.xpath("//li[4]/a[2]/em/span/span")).click();
    driver.findElement(By.xpath("//li[5]/a[2]/em/span/span")).click();
    driver.findElement(By.xpath("//li[6]/a[2]/em/span/span")).click();
    driver.findElement(By.xpath("//li[7]/a[2]/em/span/span")).click();
    driver.findElement(By.xpath("//li[8]/a[2]/em/span/span")).click();
    driver.findElement(By.xpath("//li[9]/a[2]/em/span/span")).click();
    driver.findElement(By.xpath("//li[10]/a[2]/em/span/span")).click();
    driver.findElement(By.xpath("//li[11]/a[2]/em/span/span")).click();
    driver.findElement(By.xpath("//li[12]/a[2]/em/span/span")).click();

    //here you can perform operation in pop-up window**

    //After finished your operation in pop-up just select the main window again
    System.out.println("World");
    driver.close();
    driver.switchTo().window(mwh);

    }

    }

    The Stack trace is as follows.

    org.openqa.selenium.TimeoutException: Timed out after 20 seconds waiting for visibility of element located by By.xpath: //li[2]/a[2]/em/span/span
    Build info: version: '2.21.0', revision: '16552', time: '2012-04-11 19:09:00'
    System info: os.name: 'Windows XP', os.arch: 'x86', os.version: '5.1', java.version: '1.6.0_33'
    Driver info: driver.version: FieldedSearchDriver
    at org.openqa.selenium.support.ui.FluentWait.timeoutException(FluentWait.java:252)
    at org.openqa.selenium.support.ui.FluentWait.until(FluentWait.java:221)
    at scripts.FieldedSearchDriver.login(FieldedSearchDriver.java:95)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:80)
    at org.testng.internal.Invoker.invokeMethod(Invoker.java:702)
    at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:894)
    at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1219)
    at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)
    at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)
    at org.testng.TestRunner.privateRun(TestRunner.java:768)
    at org.testng.TestRunner.run(TestRunner.java:617)
    at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)
    at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329)
    at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)
    at org.testng.SuiteRunner.run(SuiteRunner.java:240)
    at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:53)
    at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:87)
    at org.testng.TestNG.runSuitesSequentially(TestNG.java:1185)
    at org.testng.TestNG.runSuitesLocally(TestNG.java:1110)
    at org.testng.TestNG.run(TestNG.java:1022)
    at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:109)
    at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:202)
    at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:173)
    Caused by: org.openqa.selenium.NoSuchElementException: Unable to find element with xpath == //li[2]/a[2]/em/span/span (WARNING: The server did not provide any stacktrace information)
    Command duration or timeout: 30.62 seconds
    For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html
    Build info: version: '2.21.0', revision: '16552', time: '2012-04-11 19:09:00'
    System info: os.name: 'Windows XP', os.arch: 'x86', os.version: '5.1', java.version: '1.6.0_33'
    Driver info: driver.version: FieldedSearchDriver
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
    at java.lang.reflect.Constructor.newInstance(Unknown Source)
    at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:175)
    at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:128)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:459)
    at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:227)
    at org.openqa.selenium.remote.RemoteWebDriver.findElementByXPath(RemoteWebDriver.java:312)
    at org.openqa.selenium.By$ByXPath.findElement(By.java:344)
    at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:219)
    at org.openqa.selenium.support.ui.ExpectedConditions.findElement(ExpectedConditions.java:421)
    at org.openqa.selenium.support.ui.ExpectedConditions.access$0(ExpectedConditions.java:419)
    at org.openqa.selenium.support.ui.ExpectedConditions$4.apply(ExpectedConditions.java:121)
    at org.openqa.selenium.support.ui.ExpectedConditions$4.apply(ExpectedConditions.java:1)
    at org.openqa.selenium.support.ui.FluentWait.until(FluentWait.java:201)
    ... 25 more






    --

    You received this message because you are subscribed to the Google Groups "Selenium Users" group.

    To post to this group, send email to selenium-users@googlegroups.com.

    To unsubscribe from this group, send email to selenium-users+unsubscribe@googlegroups.com.

    To view this discussion on the web visit https://groups.google.com/d/msg/selenium-users/-/kBekZkcEYQEJ.

    For more options, visit https://groups.google.com/groups/opt_out.






    --
    You received this message because you are subscribed to the Google Groups "Selenium Users" group.
    To post to this group, send email to selenium-users@googlegroups.com.
    To unsubscribe from this group, send email to selenium-users+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupselenium-users @
categoriesselenium
postedSep 7, '12 at 3:23p
activeSep 7, '12 at 4:29p
posts2
users2
websiteseleniumhq.org

2 users in discussion

Jacky: 1 post Peter Gale: 1 post

People

Translate

site design / logo © 2022 Grokbase