I want to select a values in dropdown. and my problem is. I can't locate the specific element as they are dynamic and they will just appear in the inspect elements Once I choose a value in dropdown.
and I can't right click and inspect element the values in dropdown when the dropdown is open as it will close as soon as I left click.
I also can't use "Select" class as they are embedded in "div" html element
I also can't use "SendKeys" as the dropdown don't have textfield
Here are the codes I tried to use.
//try #1
driver.findElement(dropDown).click();
JavascriptExecutor js = (JavascriptExecutor)driver;
((WebElement) js.executeScript("document.getElementById('dropwDownID).value='VALUE I WANT'")).click();
note: when I tried this script("document.getElementById('dropwDownID).value='VALUE I WANT') in the console, it returns the value I want.
//try #2
driver.findElement(dropDown).click();
WebDriverWait wait = new WebDriverWait(driver, 30);
wait.until(ExpectedConditions.elementToBeClickable(this_Element_Only_Appear_When_I_Choose_A_Value));