Как выбрать из поля выбора прокрутки - PullRequest
0 голосов
/ 26 марта 2020

Я использую Selenium, чтобы попытаться выбрать из странного поля выбора прокрутки (рисунок ниже). Я пытаюсь использовать опцию Select, как и в случае с выпадающими списками, но здесь это не похоже на ответ.

#I've tried finding the path to the element like this, trying to got the option I wanted.
profession = Select(driver.find_element_by_xpath('//*[@id="ctl00_MainContentPlaceHolder_ucLicenseLookup_ctl03_lbMultipleCredentialTypePrefix"]/option[28]'))
profession.select_by_value("Pharmacy")
#and I've tried using this.
profession = Select(driver.find_element_by_xpath('//*[@id="ctl00_MainContentPlaceHolder_ucLicenseLookup_ctl03_lbMultipleCredentialTypePrefix"]'))
profession.select_by_value("Pharmacy")
#Both of which fail to find the item I'm going for.enter image description here


This is what the box I need to select from looks like.

1 Ответ

1 голос
/ 26 марта 2020

Попробуйте с приведенным ниже.

driver.find_element_by_xpath("(//*[@id='ctl00_MainContentPlaceHolder_ucLicenseLookup_ctl03_lbMultipleCredentialTypePrefix']/option)[28]").click()
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...