<div>
<div class="SumoSelect sumo_tenant_list" tabindex="0"><select id="tenant_list" name="tenant_list" class="form-select mb-3 searchable form--input form-control select-single SumoUnder" tabindex="-1">
<option value="2">
AB
</option>
<option value="3" selected="selected">
CD
</option>
</select><p class="CaptionCont SelectBox search" title="
CD
"><span>
CD
</span><label><i></i></label><input type="text" class="search-txt" value="" placeholder="Enter here."></p><div class="optWrapper"><ul class="options"><li class="opt"><label>
AB
</label></li><li class="opt selected"><label>
CD
</label></li></ul><p class="no-match"></p></div></div>
</div>
tenant_switcher = Select(self.driver.find_element(By.ID, "tenant_list"))
tenant_switcher.select_by_value("2")
Got error selenium.common.exceptions.ElementNotInteractableException: Message: element not interactable: Element is not currently visible and may not be manipulated
Got error selenium.common.exceptions.ElementNotInteractableException: Message: element not interactable: Element is not currently visible and may not be manipulated
Как можно поправить? На экране он виден
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
driver = webdriver.Chrome()
driver.get("example.com")
# находим и кликаем на элемент .SumoSelect
dropdown_container = driver.find_element(By.CSS_SELECTOR, ".SumoSelect")
dropdown_container.click()
# ждем появления элемента li.opt label, но не более 10 сек
option_to_select = WebDriverWait(driver, 10).until(
EC.element_to_be_clickable((By.CSS_SELECTOR, "li.opt label"))
)
# итерируемся по всем option и кликаем, если текст option равен AB
for option in options:
if "AB" == option.text.strip():
option.click()
break
else:
print("Не удалось найти нужную опцию.")
driver.quit()