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
Post a Comment