Python 无法选择剑道UI+;Angular JS下拉列表

Python 无法选择剑道UI+;Angular JS下拉列表,python,python-3.x,selenium,selenium-webdriver,selenium-chromedriver,Python,Python 3.x,Selenium,Selenium Webdriver,Selenium Chromedriver,您好,我无法选择下拉选项 Sampe下拉列表: 我想选择“STATIC DAT”作为“Austria”python 我可以单击下拉菜单,所有菜单都可见,但无法选择任何选项 我下载的示例代码: xpath = r'/html/body/div[4]/div[2]/div[2]/div/div/span[1]/span/span[2]' element_inst = web_driver.find_element_by_xpath(xpath) # C

您好,我无法选择下拉选项

Sampe下拉列表:

我想选择“STATIC DAT”作为“Austria”python

我可以单击下拉菜单,所有菜单都可见,但无法选择任何选项

我下载的示例代码:

        xpath = r'/html/body/div[4]/div[2]/div[2]/div/div/span[1]/span/span[2]'
        element_inst = web_driver.find_element_by_xpath(xpath)
        # Click dropdown list
        psu.perform_action(web_driver, element_inst, 'click')
        # Select option
        web_driver.find_element_by_xpath("//span[text()='Austria']").click()

有什么解决办法吗?谢谢

您可以尝试以下示例

dropdown = web_driver.find_element_by_xpath("//span[@class='k-widget k-dropdown']//span[text()='Albania']") // we depend on default country in list
dropdown.click() // trigger the dropdown

country = web_driver.find_element_by_xpath("//div[@class='k-list-scroller']/ul/li[text()='Austria']")
country.click() // select the country
或者尝试只使用“选择”标记(由于显示:无,因此不确定是否有效)

如果无法按常规方式选择元素,请尝试使用jsclick

web_driver.execute_script("arguments[0].click();", selectCountry)

您好,当我尝试第二种方法时,我得到了错误
错误:消息:元素不可交互:元素当前不可见,可能无法操作
web_driver.execute_script("arguments[0].click();", selectCountry)