Not able to access bootstrap modal dialog in Selenium Webdriver -


i want access content of model dialog box open, , want access buttons (yes,no).

here html code looks like

<div class="modal-dialog"> <div class="modal-content">     <div class="modal-header"><div class="bootstrap-dialog-header">         <div class="bootstrap-dialog-close-button" style="display: none;">             <button class="close">×</button>         </div>         <div class="bootstrap-dialog-title" id="e6adf6aa-dcbf-4fb8-9935-c083762f2812_title">         inactivate user         </div>     </div> </div> <div class="modal-body">     <div class="bootstrap-dialog-body">         <div class="bootstrap-dialog-message">         sure want inactivate user?         </div>     </div> </div> <div class="modal-footer">     <div class="bootstrap-dialog-footer">         <div class="bootstrap-dialog-footer-buttons">             <button class="btn btn-default" id="868d2d8a-67f6-4308-a3c8-0246a5d4618c">yes</button>             <button class="btn btn-default" id="23e4d027-ef32-4b58-b8b6-6f95bead2db4">no</button>         </div>     </div> </div> 

one more thing id of buttons dynamic.

i found solution after googling... here simple solution this

//switch active element here in our case model dialogue box. driver.switchto().activeelement();  thread.sleep(3000);  // find button contains text "yes" have dynamic id driver.findelement(by.xpath("//button[contains(text(),'yes')]")).click(); 

this code solves problem.


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -