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

select('value') cannot contain round bracket ( ) as value #16045

Closed
jimmy-foong opened this issue Apr 17, 2021 · 6 comments · Fixed by #16196
Closed

select('value') cannot contain round bracket ( ) as value #16045

jimmy-foong opened this issue Apr 17, 2021 · 6 comments · Fixed by #16196
Assignees
Labels
existing workaround pkg/driver This is due to an issue in the packages/driver directory type: bug

Comments

@jimmy-foong
Copy link

Current behavior

select() are not able to find and select value with round bracket ( ). Example value: lorem (lorem)

Desired behavior

select() should be able to find and select value with any special characters

Test code to reproduce

cy.get('select#dropdownelement').select('Lorem (ipsum)');

Versions

7.1.0

Note

Had tested it with no round bracket ( ) and is able to select the desired value

2021-04-17_16-05-33

@sainthkh
Copy link
Contributor

Can you give us a reproducible example? I tested with the code below, but it works without fail.

<select>
  <option value="456">apples</option>
  <option value="457 (x)">oranges</option>
  <option value="458">bananas</option>
  <option value="Lorem (Ipsum)">Lorem</option>
</select>
it('x', () => {
  cy.visit('index.html')
  cy.get('select').select('Lorem (Ipsum)')
})

@sainthkh sainthkh added the stage: awaiting response Potential fix was proposed; awaiting response label Apr 19, 2021
@jimmy-foong
Copy link
Author

jimmy-foong commented Apr 19, 2021

Code snippet below

<select name="valueDropDown">
<option value="111&nbsp;Lorem (Ipsum)">111&nbsp;Lorem (Ipsum)</option>
</select>

Coding using Page object pattern
Page Code

getDropDown() { return cy.get('select#valueDropDown'); }

selectDropDownValue(value) {
	this.getDropDown().select(value);
}

Test Case Code

pageCode.selectDropDownValue('111&nbsp;Lorem (Ipsum)');

@sainthkh
Copy link
Contributor

Confirmed that it doesn't work.

<select>
  <option value="456">apples</option>
  <option value="457 (x)">oranges</option>
  <option value="458">bananas</option>
  <option value="111&nbsp;Lorem (Ipsum)">111&nbsp;Lorem (Ipsum)</option>
</select>
it('x', () => {
  cy.visit('index.html')
  cy.get('select').select('111&nbsp;Lorem (Ipsum)')
})

@sainthkh sainthkh added pkg/driver This is due to an issue in the packages/driver directory stage: ready for work The issue is reproducible and in scope and removed stage: awaiting response Potential fix was proposed; awaiting response labels Apr 20, 2021
@sainthkh
Copy link
Contributor

It can be solved by changing &nbsp; to \u00a0 like below:

cy.get('select').select('111\u00a0Lorem (Ipsum)')

credits to this answer

@cypress-bot
Copy link
Contributor

cypress-bot bot commented Apr 27, 2021

The code for this is done in cypress-io/cypress#16196, but has yet to be released.
We'll update this issue and reference the changelog when it's released.

@cypress-bot cypress-bot bot removed the stage: needs review The PR code is done & tested, needs review label Apr 27, 2021
@cypress-bot
Copy link
Contributor

cypress-bot bot commented May 10, 2021

Released in 7.3.0.

This comment thread has been locked. If you are still experiencing this issue after upgrading to
Cypress v7.3.0, please open a new issue.

@cypress-bot cypress-bot bot locked as resolved and limited conversation to collaborators May 10, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
existing workaround pkg/driver This is due to an issue in the packages/driver directory type: bug
Projects
None yet
3 participants