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

Can not use command "select" to operate a dropdown list #1848

Open
heandping opened this issue Jul 17, 2024 · 5 comments
Open

Can not use command "select" to operate a dropdown list #1848

heandping opened this issue Jul 17, 2024 · 5 comments

Comments

@heandping
Copy link

Im using selenium IDE is 4.0.1-beta.13, chrome is Version 126.0.6478.127 (Official Build) (arm64)

Try to select from dropdown list, but failed here
image

Here is the page DOM
image

Error pasted here:
0:38:46 AM [warn] [
'Unexpected error occured during command:',
'select-xpath=//select[@name="perPageSelect"]-label=30',
'retrying...'
]
10:38:46 AM [error] [
no such element: Unable to locate element: {"method":"xpath","selector":".//option[. = '30']"}\n +
' (Session info: chrome=120.0.6099.291)'
]
10:38:50 AM [debug] [
'Playing state changed errored for test I009 - Alter the number of the displayed items per page'
]
10:38:50 AM [debug] [ 'Releasing window for playback' ]
10:38:50 AM [error] [
Error: Operation timed out during select:xpath=//select[@name="perPageSelect"]:label=30
at Timeout._onTimeout (/Users/heyong/.nvm/versions/node/v16.20.2/lib/node_modules/selenium-ide/build/webpack:/side-runtime/src/playback-tree/command-node.ts:187:13)
at listOnTimeout (node:internal/timers:569:17)
at processTimers (node:internal/timers:512:7)
]
10:38:50 AM [error] [
'Command failure:',
'select-xpath=//select[@name="perPageSelect"]-label=30'
]

@toddtarsi
Copy link
Contributor

@heandping - Idk why but could you see if value=30 works better than label=30?

@heandping
Copy link
Author

@toddtarsi , Thanks for the suggestion, I will try to use value instead of label

@heandping
Copy link
Author

Yes, select locator value=30 can work now, just curious why label fails, anyway this doesn't block me.

@toddtarsi
Copy link
Contributor

@heandping - To give you some idea, first we use a selector to get the element reference. From there, each option strategy does something different to get the child locator. For label, which I've struggled with, we have to use xpath. This is my xpath to go from the select to the option:

".//option[. = '30']"

It's supposed to go like one child down and check for a text match? I suck at xpath, but I bet I need some crud like this on the . part in the bracket.

".//option[normalize-space(translate(., '${nbsp}', ' ')) = '30']" 

@toddtarsi
Copy link
Contributor

Yeah, circling back on this. I bet it's that space before and after 10, 30, 50, and 100. I think I'll just make a test for this permutation. Should be easily fixed in core.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants