Search code snippets, questions, articles...

[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?
0 Comments
Programming Feeds
Learn something new everyday on Devsheet