Issue
My code:
driver.find_element_by_xpath("//svg[@class='SvgIcon_root__keb_Y'][@aria-label='Вернуться к старому дизайну']").click()
My error: selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":"//svg[@class='SvgIcon_root__keb_Y'][@aria-label='Вернуться к старому дизайну']"}
What am I doing wrong? Why doesn't Selenium find him? Because of focusable="false" and aria-hidden="true"? If because of this, how do I identify this element and click on it?
Solution
To access the the SVG
element,the xpath
should be different. It should be like.
//*[local-name()='svg' and @aria-label='Вернуться к старому дизайну']
Or
//*[local-name()='svg' and @class='SvgIcon_root__keb_Y']
Or
//*[name()='svg' and @aria-label='Вернуться к старому дизайну']
Ideally your code should be like
driver.find_element_by_xpath("//*[local-name()='svg' and @aria-label='Вернуться к старому дизайну']").click()
You can find following reference, how to interact with svg
element
xpathforsvgelement
Answered By - KunduK
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.