0

I am just beginning to use Selenium to automate pulling some reports, and am having trouble with dropdown lists.

I have utilized the Chrome Driver, but cannot figure out how to click a Kendo dropdown list to expand it, and then choose an option. Below is the HTML of the list:

<kendo-dropdownlist _ngcontent-gig-c457="" valuefield="value" textfield="label" dir="ltr" class="k-widget k-dropdown k-header"><!----><span unselectable="on" role="listbox" aria-haspopup="listbox" aria-describedby="db700edd-7cac-401c-a298-d0cba66200e4" id="CC" dir="ltr" readonly="false" tabindex="0" aria-disabled="false" aria-readonly="false" aria-expanded="false" aria-activedescendant="e5f0317f-9ac9-49f7-9a37-8289b54fca3b-null" class="k-dropdown-wrap k-state-default"><span unselectable="on" class="k-input" id="db700edd-7cac-401c-a298-d0cba66200e4"><!---->Select a Report<!----></span><span unselectable="on" class="k-select"><span unselectable="on" class="k-icon k-i-arrow-s"></span></span><!----></span><!----><!----></kendo-dropdownlist>

I have tried clicking the list by using its class name with the code below, unsuccessfully:

driver.find_element(By.CLASS_NAME, 'k-widget k-dropdown k-header').click()

I have read a few things about the Select class, but have been unable to solve how to use that in this situation.

Any help on the best way to expand dropdown lists like this, and make a selection, would be much appreciated.

I tried clicking the menu by its ID but am getting no response.

Ron A
  • 15
  • 3

1 Answers1

0

You are using a class name with spaces. Class name that contains space identify as two classes.

driver.find_element(By.CLASS_NAME, 'k-widget k-dropdown k-header').click() 

Either you can use css selector

driver.find_element(By.CSS_SELECTOR, '.k-widget.k-dropdown.k-header').click()

Or in class name replace space with 'Dot'

driver.find_element(By.CLASS_NAME, 'k-widget.k-dropdown.k-header').click()

For more information you can visit this find element by class name with spaces