I'm new to selenium and facing issue while selecting an option from the dropdown.
HTML Code:
<select id="fileselection" class="selectpicker show-menu-arrow" name="fileselection" onchange="function1('SELECTEDFILES', 'True')" multiple="" data-width="100%" data-style="btn-info" data-action-box="true" data-live-search="true" data-size="5" tabindex="-98">
<option value="URL_OF_FILE_1">
Filename_1.zip
</option>
<option value="URL_OF_FILE_2">
Filename_2.zip
</option>
</select>
URL also contains the filename
Example:
My code:
WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH, "//select[@id='fileselection']//option[contains(.,'Filename_1.zip')]")))
ele = driver.find_element_by_xpath("//select[@id='fileselection']//option[contains(.,'Filename_1.zip')]")
ele.click()
WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH, "//select[@id='fileselection']//option[@value='URL_OF_FILE_1')]")))
ele = driver.find_element_by_xpath("//select[@id='fileselection']//option[@value='URL_OF_FILE_1')]")
ele.click()
I'm getting the error at the last step(ele.click()). Wait and find element steps are working fine.
Element <option> could not be scrolled into view
Thanks!