Java/SeleniumWebDriver - Click a JQuery dialog button with Selenium -


i trying test dialog selenium webdriver "create employee" button doesn't have id nor name. code looks like.

<div class="ui-dialog-buttonpane ui-widget-content ui-helper-clearfix">     <div class="ui-dialog-buttonset">           <button type="button" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" role="button" aria-disabled="false">               <span class="ui-button-text">create employee</span>          </button>           <button type="button" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" role="button" aria-disabled="false">               <span class="ui-button-text">cancel</span>          </button>      </div>           <button type="button" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" role="button" aria-disabled="false">               <span class="ui-button-text">create employee</span>          </button>           <button type="button" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" role="button" aria-disabled="false">               <span class="ui-button-text">cancel</span>          </button>  </div> 

can provide me java code click button in dialog box? thanks

try below code.

 driver.findelement(by.xpath("//button[@type='button']/span[text()='create employee']")).click(); 

Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -