java - XPath selector Selenium WebDriver, unable to use ID -
selenium ide exported java/junit
driver.findelement(by.cssselector(".x-btn-inner:contains('yes')")) .click();
and doesn't work because contains doesn't exist in css. want pass xpath
driver.findelement(by.xpath("//.x-btn-inner[contains(., 'yes']")).click();
this code isn't working, doing wrong?
<span id="button-1006-btnel" data-ref="btnel" role="presentation" unselectable="on" style="" class="x-btn-button x-btn-button-default-small x-btn-text x-btn-button-center "><span id="button-1006-btniconel" data-ref="btniconel" role="presentation" unselectable="on" class="x-btn-icon-el x-btn-icon-el-default-small " style=""></span><span id="button-1006-btninnerel" data-ref="btninnerel" unselectable="on" class="x-btn-inner x-btn-inner-default-small">yes</span></span>
the id dynamically generated can't make use of it.
you can text:
driver.findelement(by.xpath("//span[. = 'yes']")).click();
Comments
Post a Comment