other

[Python] XPATH locator with text present in element

# HTML
<a class="dropdown-item" href="/logout">
                    <span class="dropdown-icon oi oi-account-logout"></span> Logout</a>


# Python
browser_ms.find_element(By.XPATH,'//span[text()="logout"]').click()
Was this helpful?