0

Please help me out for this problem.

I tried to close this Pop-up page with Selenium, but not able to do it.

HTML code

<div class="popupsignup-disp">
   <div class="popupsignup-cntbox">
      <div class="container-fluid">
         <div class="row">
            <div class="col-xs-10 col-xs-offset-1 col-md-10 col-md-offset-1 ntp-cnt-wrap">
               <div class="row">
                  <div class="col-xs-12 text-center voffset4"><img alt="" src="/static/img/nico-tides-moon.png"></div>
                  <div class="col-xs-12 voffset3 hidden-xs hidden-sm"></div>
                  <div class="col-xs-12 voffset2">
                     <h3 class="npr">This full moon’s extra special, and we’ve got prices to match.</h3>
                  </div>
                  <div class="col-xs-12 voffset6">
                     <h5 class="text-uppercase head-text">Special Pricing goes live</h5>
                  </div>
                  <div class="col-xs-12 voffset3">
                     <div class="row">
                        <div class="col-xs-6 text-right potd-wrap">
                           <div class="pop-time"><span>Online</span> <span class="hlgt">14 + 15 December</span> <span class="small">All Day</span></div>
                        </div>
                        <div class="col-xs-6 text-left">
                           <div class="pop-time"><span>In-store</span> <span class="hlgt">14 - 18 December</span> <span class="small">11 am To 8 pm</span></div>
                        </div>
                        <div class="pop-divider"></div>
                     </div>
                  </div>
                  <div class="col-xs-12 voffset5"><a class="text-uppercase pop-btn" href="/catalogue/category/special-price/women_126/" id="ntnc-linknclose">Shop now</a></div>
               </div>
            </div>
         </div>
      </div>
   </div>
   <a class="close-popupsignup-wrap"></a>
</div>

enter image description here

  • Add your code here, what you have tried for closing pop up. – Bharat Mane Dec 16 '16 at 12:14
0

Try this

Driver.SwitchTo().frame("Fancybox-frame");

Driver.findElement("enter your xpath to close popup").click();

Driver.SwitchTo().defaultContent();
3

You may try taking XPath of that close button which is on pop up:

WebElement closebtn = driver.findElement(By.xpath("//a[contains(@class,'close-popupsignup-wrap')]"));
closebtn.click();

or using this XPath expression:

//a[@class='close-popupsignup-wrap']
0

You have below options to close pop-up:

  • Click on "X" [close] icon on pop-up to close

  • You can click on any other visible element on page other than pop-up

How:

  • You can simply use id, name or css & perform click
0

There is another better way which im using some times. User key board keys Eg: Tab key to navigate to the popup box. Again Tab key to navigate to the button. Hit Enter key or Space key to get rid of popup.

0

Try the following:

  1. get the window handle, (provide proper delay)

  2. switch to that pop up, then click on Cross icon using XPath

  3. after that switch to default, it might work

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.