SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 5 of 5
  1. #1
    Apprentice
    Join Date
    May 2014
    Posts
    33
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Selenium Unable to switch to pop un IE window

    I am unable to switch to a pop up window using this code..
    WebElement Payment_dispute_option = wait
    .until(ExpectedConditions.elementToBeClickable(By
    .cssSelector("button[Onclick*='ymtDisputeDataWrapper&pzPrimaryPage']")));
    String ParentWindow = driver.getWindowHandle();

    Payment_dispute_option.click();


    Set<String> windowHandles = driver.getWindowHandles();
    for (String s : windowHandles) {




    if(!s.equals(ParentWindow))
    {
    try {
    Thread.sleep(50);
    } catch (InterruptedException e2) {
    // TODO Auto-generated catch block
    e2.printStackTrace();
    }
    driver.switchTo().window(s);

    //MY CODE ON NEW WINDOW HERE
    }
    }

    There is a pop window that i want to switch to but this code has been failing.. Selenium does not recognize the new pop up window that shows up.. How do I switch to the new window?

    Thank you for your assistance

  2. #2
    SQA Knight
    Join Date
    May 2006
    Location
    Playa Del Rey, California, United States
    Posts
    2,596
    Post Thanks / Like
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    Total Downloaded
    0
    I think youre you want to put the thread.sleep before the getWindow handles. since you're waiting on the response from the click.
    David Lai
    SDET / Consultant
    LinkedIn profile

  3. #3
    Apprentice
    Join Date
    May 2014
    Posts
    33
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0
    Quote Originally Posted by dlai View Post
    I think youre you want to put the thread.sleep before the getWindow handles. since you're waiting on the response from the click.
    David- Introducing Thread.sleep did not work.. but thank you for your suggestion

  4. #4
    SQA Knight
    Join Date
    May 2006
    Location
    Playa Del Rey, California, United States
    Posts
    2,596
    Post Thanks / Like
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    Total Downloaded
    0
    Is waiting on the popup failing or the element that triggers the popup?

    if it's the triggering mechanism that's failing, you might want to check if that CSS selector you're using works. One thing I noticed is you're using a CSS level 3 selector. IE doesn't get support for those until IE11. It could be it's selecting the wrong element.

    You can check it by opening up the javascript console window, and using 'document.querySelectorAll("<insert your css query here>")' and seeing if it returns [Object]
    David Lai
    SDET / Consultant
    LinkedIn profile

  5. #5
    Apprentice
    Join Date
    May 2014
    Posts
    33
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0
    Quote Originally Posted by dlai View Post
    Is waiting on the popup failing or the element that triggers the popup?

    if it's the triggering mechanism that's failing, you might want to check if that CSS selector you're using works. One thing I noticed is you're using a CSS level 3 selector. IE doesn't get support for those until IE11. It could be it's selecting the wrong element.

    You can check it by opening up the javascript console window, and using 'document.querySelectorAll("<insert your css query here>")' and seeing if it returns [Object]
    David.. Its waiting on the pop up that is failing.. Selenium is able to click on the button that causes the pop up.. that is .............WebElement Payment_dispute_option = wait
    .until(ExpectedConditions.elementToBeClickable(By
    .cssSelector("button[Onclick*='ymtDisputeDataWrapper&pzPrimaryPage']")));
    String ParentWindow = driver.getWindowHandle();

    Payment_dispute_option.click();

    BUT its unable to switch to the pop up window.. so the pop up trigger mechanism is working but not the switching to the pop up

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Search Engine Optimisation provided by DragonByte SEO v2.0.36 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 11.54%
vBulletin Optimisation provided by vB Optimise v2.6.4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.2.8 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominate (Lite) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 12:22 PM.

Copyright BetaSoft Inc.