Hi everyone,
I am encountering an issue during testing.
I cannot manage to scroll down in a dropdown.
The flow is the following:
- click a field
- a dropdown is shown on the page
- now, in order for me to select the value that I need I must scroll in the dropdown.
I have tried the scroll to element method but it would scroll the main page instead of the dropdown.
The code_x locator is a variable that goes in a test data file to pick the values that I want to select in the dropdown.
Thanks for you help.
If you right click on one of the drop-down contents (like on “FM02b_10”) and select Inspect, does the HTML look like a column of similar element types? In other words, can you collect a list of web elements (List<WebElement>
) and then move through the list of elements like they were a “table” and choose one this way. It may mean to “loop” through the “table” comparing the items to your “pick”.
Hi,
Does anyone have a different approach for handling the issue?
Thanks 
In essence, @grylion54 has given you a pretty clear method to approach this problem. Instead of just ignoring what’s been said, can you explain why it didn’t work for you?
My approach would be something like…
- Using JavaScript…
- Make the dropdown appear
- Call the Web API
scrollIntoView()
on the element I need to see
- Click the element.
Hi Russ,
I did not ignore the answer, I am working on it.
I was just curious for other approaches.
I highly appreciate the answer.
Irina
Hi Russ,
I am working on the approach you described me above, however I still do not see the scroll in the dropdown functioning.
I guess I am still missing something related to the scriollIntoView function.
Found the solution,
I had to change the value of the scrollIntoView function to “false”.
Thanks
1 Like
Interesting. I’ve only ever used the default, true
.
Good you got it working 