Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static boolean selectDropdownOption(@NonNull String elementSelector, @NonNull String relativeXpath, @NonNull String value, int tabIndex) {
- WebElement relativeElement = getRelativeElement(elementSelector, relativeXpath, tabIndex);
- WebElement divAriaControls = relativeElement.findElement(By.xpath("//div[@aria-controls]") );
- if (null != divAriaControls) {
- String ariaControls = divAriaControls.getAttribute("aria-controls");
- relativeElement.click();
- WebElement dropdownDiv = getElementBySelector(ariaControls + "~ID", tabIndex);
- dropdownDiv.findElement(By.xpath("//*[text() = '" + value + "']")).click();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement