Я довольно новичок в Selerium и html. Я пытаюсь изменить значение раскрывающегося меню. Я нашел несколько подобных примеров, но ни один из них, похоже, не работает для меня. Код, который я пытаюсь использовать, Я пытался с selectRole.change_by_value ("MEMBER") et c.
def invitePersonToProject(email, role, team, message):
email_form = driver.find_element(By.XPATH, '//*[@id="content-panel"]/div/div[5]/div[5]/div/div[1]/div/div[2]/div/div[1]/div[1]/table/tfoot/tr[2]/td[1]/span[2]/span[1]/span/ul/li/input')
email_form.send_keys(email)
selectRole = Select(driver.find_element(By.XPATH, '//*[@id="content-panel"]/div/div[5]/div[5]/div/div[1]/div/div[2]/div/div[1]/div[1]/table/tfoot/tr[2]/td[2]/select'))
selectRole.select_by_index(0)
, что дает мне следующую ошибку для выбора роли при запуске
selenium.common.exceptions.ElementNotInteractableException: Message: element not interactable: Element is not currently visible and may not be manipulated
(сеанс информация: chrome = 80.0.3987.122) [введите описание изображения здесь] [1]
Код html:
<select class="bs-select2 role-select select2-hidden-accessible" style="width: 100%; display: none;" tabindex="-1" aria-hidden="true">
<option value="ADMIN">Administrator</option>
<option value="MEMBER">Deltaker</option>
</select>
<span class="select2 select2-container select2-container--bootstrap select2-container--below select2-container--focus" dir="ltr" style="width: 100%;"><span class="selection"><span class="select2-selection select2-selection--single" role="combobox" aria-haspopup="true" aria-expanded="false" tabindex="0" aria-labelledby="select2-x915-container"><span class="select2-selection__rendered" id="select2-x915-container" title="Administrator">Administrator</span><span class="select2-selection__arrow" role="presentation"><b role="presentation"></b></span></span></span><span class="dropdown-wrapper" aria-hidden="true"></span></span>