[very new to selenium]
I am using python selenium to click drop downs on a webpage. I can successfully do this using xpath. All the drop downs I want to click are exactly like that ofcourse with the number changing for each of them after the select:
gender = driver.find_element_by_xpath('//*[@id="react-select-7--value"]/div[2]/input')
gender.send_keys('Male')
gender.send_keys(Keys.DOWN)
gender.send_keys(Keys.DOWN)
gender.send_keys(Keys.RETURN)
How can I unique identify the react-select-20--value to click on the drop down ?
Below is the html from the 'highest' div class that encapsulates the react-select-20--value I want to click here, in this Gender.
Other drop downs have a similar structure too.
<div class="col-md-2">
<div class="form-input form-group has-error">
<span class="glyphicon glyphicon-asterisk"></span>
<label for="customer.gender" class="control-label">Patient Gender</label>
<span class="input-group">
<div class="Select is-searchable Select--single">
<div class="Select-control">
<span class="Select-multi-value-wrapper" id="react-select-20--value">
<div class="Select-placeholder">Select:</div>
<div class="Select-input" style="display: inline-block;">
<input aria-activedescendant="react-select-20--value" aria-expanded="false" aria-haspopup="false" aria-owns="" role="combobox" value="" style="box-sizing: content-box; width: 5px;">
<div style="position: absolute; top: 0px; left: 0px; visibility: hidden; height: 0px; overflow: scroll; white-space: pre; font-size: 14px; font-family: Helvetica, Arial, sans-serif; font-weight: 400; font-style: normal; letter-spacing: normal; text-transform: none;">
</div>
</div>
</span>
<span class="Select-arrow-zone">
<span class="Select-arrow"></span>
</span>
</div>
</div>
</span>
<span class="help-block">Select Gender</span>
</div>
</div>
edit: this is not duplicate question because I can select the drop down but can not select the drop down when the link ID changes.