Need to be able to click one/more elements from the elements list.
The front-end is written in ReactJS and for styling Material-UI is used.
WHAT HAPPENS: When clicked on <input'> element, a popup with a list of elements opens up.
I tried accessing the "popup elements" of input unsuccessfully using xpath (input element is accessible though).
By chiefComplaintInputElem= By.cssSelector("#single-imit-tagschief_complaint");
By chiefComplaintOption0= By.xpath("//input[@id='single-imit-tagschief_complaint' and
@aria-activedescendant='single-imit-tagschief_complaint-option-0']");
By chiefComplaintOption1= By.xpath("//input[@id='single-imit-tagschief_complaint' and
@aria-activedescendant='single-imit-tagschief_complaint-option-1']");
**approach-1**
driver.findElement(chiefComplaintInputElem).click(); //works fine
driver.findElement(chiefComplaintOption0).click(); //error here
**approach-2**
webDriverWait.until(ExpectedConditions.visibilityOfElementLocated(chiefComplaintInputElem)).click(); //works fine
webDriverWait.until(ExpectedConditions.presenceOfElementLocated(chiefComplaintOption0)).click(); //error here
While inspecting the <input'> element, It has the following attributes at the beginning.
<input aria-invalid="false" autocomplete="off" id="multiple-limit-tagschief_diagnosis" placeholder="Select conditions"
type="text" class="MuiInputBase-input MuiOutlinedInput-input MuiAutocomplete-input MuiAutocomplete-inputFocused
MuiInputBase-inputAdornedEnd MuiOutlinedInput-inputAdornedEnd" aria-autocomplete="list" autocapitalize="none"
spellcheck="false" value="" xpath="1">
When clicked on the input field, new HTML attribute 'aria-controls' gets appended to the input element attributes.
<input ... aria-controls="multiple-limit-tagschief_diagnosis-popup">
And a popup opens with a list of elements.
when I "mouse-over" to the elements of the list, an additional HTML attribute 'aria-activedescendant' gets appended in the input element with a unique value.
(When the mouse pointer is moved over to each option is tied to a unique value like below, where NUM has values 0,1,2,...)
<input ... aria-activedescendant="multiple-limit-tagschief_diagnosis-option-NUM">
See if the following images are of any help...

