无法在python selenium中选择JS下拉选项

时间:2018-05-10 03:08:06

标签: javascript python selenium

我的HTML视图 - Wesite view

HTML code- HTML

以下代码仅在我点击下拉箭头时进入查看 - code 我的代码可以显示下拉选项,但无法从中选择一个选项 -

drop1 = driver.find_element_byxpath("//*[@id='s2id_autogen1']/a/span[2]")
drop1.click()

1 个答案:

答案 0 :(得分:0)

// click on the `Administrative Owner` to trigger the dropdown display out
driver.find_element_by_xxx('yyy').click()

optionText = 'aapt-midrangewindows'
xpath = "//div[@id='select2-drop']/ul/li[.='{1}']".format(optionText)

// choose the option by given option text
driver.find_element_by_xpath(xpath).click()
相关问题