As shown in picture i have these elements in a tree.If i press CTRL in KEY BOARD and click on these text-i can select multiple elements and it will give links to do some actions.Using cypress is there any way to achieve this ? i know if it is select, i can use select -in my case these are just 'ul'.Also i know while tying text we have options, is there any options in cypress to mock this Key board action while click or selecting elements
As shown in picture i have these elements in a tree.If i press CTRL in KEY BOARD and click on these text-i can select multiple elements and it will give links to do some actions.Using cypress is there any way to achieve this ? i know if it is select, i can use select -in my case these are just 'ul'.Also i know while tying text we have options, is there any options in cypress to mock this Key board action while click or selecting elements
Share Improve this question edited Jun 20, 2020 at 9:12 CommunityBot 11 silver badge asked Mar 6, 2019 at 2:34 user8710571user8710571 4552 gold badges14 silver badges25 bronze badges2 Answers
Reset to default 5We are using this syntax:
cy.get('body')
.type('{alt}', {release: false})
cy.get('.heading')
.click()
cy.get('.tooltip__header')
.should('contain', 'Translate')
So in your case it would be something like this:
cy.get('body')
.type('{ctrl}', {release: false})
cy.get('Sugar CSP Segmentation')
.click()
cy.get('Health & Welness Segments')
.click()
An alternative syntax, which reads more intuitively IMO, is to pass the ctrlKey
option (documentation):
cy.get('Sugar CSP Segmentation').click()
cy.get('Health & Welness Segments').click({ctrlKey: true})