Hi i am trying to locate element in selenium:
<button class="add-widget ui-button ui-widget ui-state-default ui-corner-all ui-button-icon-only" title="Add widget" role="button" aria-disabled="false">**
<span class="ui-button-icon-primary ui-icon ui-icon-plus"></span>
<span class="ui-button-text"></span>
</button>
I tried to use this xpath selection:
driver.findElement(By.xpath("//button[contains(@class,'add-widget ui-button ui-widget ui-state-default ui-corner-all ui-button-icon-only ui-state-hover')]/span[contains(@class,'ui-button-icon-primary')]")).click();
But it doesn't work and gives NoSuchElementException
.
Could you give me an advice how to build xpath to this element?