-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Need a "rightclick" command #53
Comments
I would also like to have this functionality. |
I've created my own custom command which is working for me: Cypress.addChildCommand('contextmenu', ($subject) => {
const log = Cypress.Log.command({
name: 'CONTEXTMENU'
})
const e = document.createEvent('HTMLEvents');
e.initEvent('contextmenu', true, false);
$subject[0].dispatchEvent(e);
log.snapshot().end()
}) Usage: |
With cy.get('button').trigger('contextmenu', options) |
I still would vote for a right click helper :) |
The delivery of a specific |
Workaround Example of triggering cy.get('#nav').first().trigger('contextmenu') Example of right clicking on an element using jQuery cy.get('#nav').first().invoke('trigger', 'contextmenu') |
Hi all, Thanks in advance |
@indrajitbnikam if you're talking about the native context menu, then you cannot, since it's not rendered to the DOM, it's native code. |
@bkucera No I'm not talking about browser's native context menu. I'm talking about context menu from our application. cy.contains(val).first().click().trigger('contextmenu');
cy.get('si-context-menu ul').contains('li', 'Delete').first().click(); It is visible in DOM and CSS selector that I'm using points towards the same element but I'm not able to click it. |
Hi Everyone it worked, Problem was that it was not visible unless I am moving my mouse into context menu. cy.contains(val).first().click().trigger('contextmenu');
cy.get('si-context-menu ul').contains('li', 'Delete').first().trigger('mouseenter').click(); |
Is right click available in 3.4.0? |
@loveqseven The issue will be closed and marked with a release number when it is released. If an issue is still open, it is not released. |
I tried suggestions from @oliver3 and @brian-mann, they both work for some url e.g. http://teselagen.github.io/openVectorEditor/#/Editor |
The code for this is done in cypress-io/cypress#3030, but has yet to be released. |
Released in |
@loveqseven are you able to use the |
still can't use rightclick to replace trigger('contextmenu'), it's always giving me this error:
|
@nbcp could you open up an issue with some screenshots / reproducible example? |
I wrote it up in #5698 |
I need the ability to right click an element within Cypress so that it triggers the
contextmenu
event and all that entails.The text was updated successfully, but these errors were encountered: