1

I want to click on an svg image with this tag below:

<svg class="Offer__rowIcon___I2EwO " width="18px" height="14px" viewBox="0 0 18 14" version="1.1">
    <defs></defs>
    <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
        <g id="Icons" transform="translate(-267.000000, -971.000000)" fill="#FFFFFF">
            <g id="check" transform="translate(267.000000, 971.000000)"><g id="Livello_1">
                <g id="Livello_1">
                <polygon id="Shape" points="6.36363636 13.2618182 0 6.89818182 1.79454545 5.10363636 6.36363636 9.66 16.0236364 0 17.8181818 1.80727273">
                </polygon>
                </g>
            </g>
        </g>
    </g>
</svg>

I have tried the following code:

WebDriverWait(browser, 20).until(EC.element_to_be_clickable((By.XPATH, "//*[name()='svg:image' and starts-with(@class, 'Offer__rowIcon___I2EwO ')]"))).click()

However I get the following message:

raise TimeoutException(message, screen, stacktrace) TimeoutException

Can anyone advise how to click on this element?

CEH
  • 5,701
  • 2
  • 16
  • 40
Thehog
  • 19
  • 1
  • Perhaps you can drill down to see the precise issue: can you prove (to yourself) that you can select a basic SVG? If so, can you then select the SVG with the `starts-with` part of your string? If you can do that, then add back in your more complex SVG and see if you can select it with your refined code. If any of these steps works but a subsequent step does not, post the status of your testing in the question. – Brian Dant Dec 11 '19 at 22:36
  • Does the answer to this question help? https://stackoverflow.com/questions/41829000/how-to-click-on-svg-elements-using-xpath-and-selenium-webdriver-through-java – Brian Dant Dec 11 '19 at 22:38

0 Answers0