如何 select 在 python 中使用 selenium 从下拉列表中选择一个选项

How to select an option from dropdown using selenium in python

我想select使用下面列表中的硒的选项:

HERE

但问题是没有 select 来自的列表。

enter image description here

到目前为止我的代码:

from seleniumwire import webdriver 
from webdriver_manager.chrome import ChromeDriverManager
from selenium.webdriver.chrome.options import Options
 
chrome_options = Options()
#chrome_options.add_argument("--headless")
# for linux/Ubuntu only
#chrome_options.add_argument("--no-sandbox") 


browser = webdriver.Chrome(ChromeDriverManager().install(), 
  chrome_options=chrome_options)
browser.get('https://www.ibm.com/demos/live/tts-demo/self-service/home')
#element = browser.find_element_by_id('downshift-2-toggle-button').click()
#select_voice = Select(element)
voice= browser.find_element_by_xpath('//*[@id="downshift-2-toggle- 
 button"]/span')
browser.execute_script('arguments[0].innerHTML = "Michael";', voice)

需要帮助!!

要查找元素 Michael,请单击神经语音跨度,然后单击带有 Michael 文本的标签。

voice = browser.find_element_by_xpath("//*[@id='downshift-2-toggle-button']/span")
voice.click()
browser.find_element_by_xpath("//div[.='Michael']").click()