Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account on a SVG or an element containing SVG throws Illegal Invocation error in Cypress 3.0.3 #2258

greglds opened this issue Aug 2, 2018 · 1 comment


Copy link

@greglds greglds commented Aug 2, 2018

Current behavior:

Since update to 3.0.3, cy.get( "element containing SVG" ).click() throws an error:
CypressError: Timed out retrying: Illegal invocation

Available workaround is to use { force: true } (doesn't work when clicking on SVG directly)

Desired behavior:

The same behavior as the other elements (not containing SVG): a simple click.

Steps to reproduce:

given this html body:

    <span id="test-text" href="#">
    <span id="test-svg" href="#">
        <svg height="100" width="100">
            <circle cx="50" cy="50" r="40" stroke="black" stroke-width="3" fill="red" />

and this spec:

describe("test click on svg", () => {
	beforeEach( () => {
	} );
	it( "clicks a span containing text", () => {
	} );
	it( "clicks a span containing SVG", () => {
	} );

I obtain this result:


My current workaround:

Cypress.Commands.overwrite("click", (originalFn, subject, options = {}) => { 
    if( subject[ 0 ].getElementsByTagName('svg').length ) { 
        Object.assign( options, { force: true } ); 
    return originalFn(subject, options); 


Cypress 3.0.3, Windows 7, Chrome v 67.0.3396.99

On a side note, Cypress is great !

Copy link

@brian-mann brian-mann commented Aug 2, 2018

This has already been fixed in a PR and will go out in the next patch release... approximately less than 24 hours.


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

3 participants