0

I am trying to use selenium for clicking on a svg element in order to close a pop up:

<div class=" light-ui-pop-up--header">
<svg name="ClosePopUp" class="pop-up--close-btn" width="14" height="14" viewBox="0 0 14 14" xmlns="http://www.w3.org/2000/svg"><path d="M14 1.41L12.59 0L7 5.59L1.41 0L0 1.41L5.59 7L0 12.59L1.41 14L7 8.41L12.59 14L14 12.59L8.41 7L14 1.41Z" fill="#ffffff"></path></svg>>

Following previous answers on stack overflow, I have tried:

wd.find_element_by_xpath('//div[@class="light-ui-pop-up--header"]/*[name()="svg"][@id="Root"]').click()

and

wd.find_element_by_xpath('//div[@class="light-ui-pop-up--header"]/*[name()="svg"][@name="ClosePopUp"]').click()

But in both cases, I have got the same error:

selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":"//div[@class="light-ui-pop-up--header"]/*[name()="svg"][@id="Root"]"}

How could I close the emergent pop up with selenium python on this page: https://data.anbima.com.br/debentures/JTEE11/caracteristicas

1 Answer 1

1

You can try the below locator:

wd.find_element(By.XPATH, ".//div[@class=' light-ui-pop-up--header']/*[local-name()='svg']").click()
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.