-
Notifications
You must be signed in to change notification settings - Fork 140
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
Unable to select the list items in dropdown #182
Comments
See if this issue helps you: |
I used the index for selecting the dropdown list. It's working fine. The following is the code.
|
try to press page down button until your element will be clickable and then click on this element. |
I already tried that and it's working. But I'm looking for other solutions. |
if your element don't have scrollPattern then its impossible to scroll in different way |
How to know that element has scroll pattern? |
@krishnakanth19 Can you please share code snippet of how page down can be used in the code? When we attempt to perform any key combo actions like Ctrl+g (application internal command) it acts like Ctrl+A and selects all the form. @heilwood, Ours is a windows application inside which webforms are rendered. We are able to perform send_keys method to type on fields inside Webforms fields (shown in image 2). However any key combo like page down, page up, ctrl + g with the step as doesn't work |
I don't write any code for that. My issue is when I'm trying to select an item in the dropdown list which is hidden. It is not scrolling and clicking outside the dropdown list. |
Hi krishnakanth19 , |
Hi mheshvelpuri, I don't get proper solution for that. I'm reading all elements into a list and iterating throw it to click on a particular drop down item. If the element is hidden in the drop-down it is failing. So, if the element is hidden, I first call a method to scroll down and then clicks on that. |
Hi krishnakanth19 |
Hi heilwood, Could you please share your idea on scrolling an element which has scroll pattern. |
Hi krishnakanth19, But, when the combo box is loaded with huge number of options, not all the options are getting loaded after expanding the combobox. Suppose if you have 40 options, only first 25 of the elements are getting identified. elements from 26th position to 40th position are throwing NoSuchElement Exception. Then, if I scroll to 10th element, elements from 5th position to 30th position are getting identified, first 4 elements and last 10 elements are throw NoSuchElement Exception. Here, I am looking for identifying all the elements at a time and throw NoSuchElement Exception if the target element is out of those all 40 options. [like selectByVisibleText from Select class]. |
Hi srinivask91, The following is the code I used to scroll down. I used click events on the page down until element is visible and then clicked on that element. |
Hi @krishnakanth19 |
getsize() will get only the dimensions of width and height of combobox. |
What about using Robot to scrollDown, or control the mouse wheel |
Hi,
While selecting the location I’m able to click on the list items which are visible. But I’m unable to select the other locations in the dropdown list. When trying to select other location in dropdown list which is not visible in the drop-down, it is clicking somewhere else.
I.e. I’m able to click the list items up to “CARTAGE LA” (the location in dropdown list are visible up to CARTAGE LA). For the other locations, it is clicking outside the list.
WebElement ele = driver.findElement(By.id("cmbLocation"));
ComboBox combo = new ComboBox(ele);
combo.expand();
List<WebElement> lis = ele.findElements(By.className("ListBoxItem"));
lis.get(42).click();
I used list index to locate elements. How can I locate them with visible text? I used the following code but it's not working.
WebElement ele = driver.findElement(By.id("cmbLocation"));
ComboBox combo = new ComboBox(ele);
combo.expand();
List<WebElement> lis = ele.findElements(By.className("ListBoxItem"));
for(int i = 0; i< lis.size(); i++) {
WebElement elem = lis.get(i).findElement(By.name("ATLANTA"));
if("ATLANTA".contains(elem.getText())) {
lis.get(i).click();
break;
}
}
The text was updated successfully, but these errors were encountered: