I am trying to select the second option from the div drop down via python/selenium. The code below is what I have so far. The first line opens the drop down and works. The second line attempts to select the 2 option and click it. I have tried "2", "22", and "Option-22" but none seem to work.
Sample Python Selenium Code
#opens drop down
browser.find_element(By.XPATH,".//*[@id='Account']").click()
#selects item from dropdown
browser.find_element(By.XPATH,".//*[@id='Account']/option[22]").click()
Error Message:
Message: invalid selector: Unable to locate an element with the xpath expression .//*[@id='Account']/option[22] because of the following error:
SyntaxError: Failed to execute 'evaluate' on 'Document': The string './/*[@id='Account']/option[22]' is not a valid XPath expression.
Sample HTML Code:
<div id="Account" class="">
<select>
<option selected="" value="11">Option-11</option>
<option value="22">Option-22</option>
<option value="33">Option-33</option>
</select>
</div>