How to check if there's a condition and click on it?

Viewed 32

I need to check if appear a text "Issue detected" on a page, and if yes I need to click on it. How can I do that?

This is the text:

<span class="mdi mdi-alert-circle-outline ml-5 mr-2">Issue Detected</span>

I've tried with this:

driver.find_element_by_xpath("//span[text()='Issue Detected']").click()

but it doesn't work.

edit:

i've tried this, and seem work:

issue= driver.find_element_by_xpath("//body/div[2]/div[1]/aside[1]/div[1]/div[1]/div/div[1]/div[1]/div[2]/span[5]")

Now the problem is that i need on click, but log is telling me that is not a clickable element. i need to click only when there is "issue detect" how can i do it?

0 Answers
Related