Consider i have this HTML
:
<span class="bla">Create New</span>
How can i get this element ?
I try:
span:contains("Create")
You can use the "by xpath" locator:
driver.findElement(By.xpath("//span[. = 'Create New']"));
EDIT - xpath selector to get by text:
driver.findElement(By.xpath("//span[contains(.,'Create New')]"));