M
M
MegaTort2021-01-24 17:42:19
Python
MegaTort, 2021-01-24 17:42:19

Python Selenium how to select an option from a drop down list?

I don't need to select one of the options from the drop down list
But it doesn't work...
Clicking either doesn't give me any error

driver.find_element_by_class_name('form-control').find_elements_by_tag_name('option')[1].clik()
AttributeError: ' WebElement' object has no attribute 'clik'

or

Select(driver.find_element_by_class_name('form-control')).select_by_value('D48')
selenium.common.exceptions.NoSuchElementException: Message: Cannot locate option with value: D48

or

driver. find_element_by_class_name('form-control').click()
selenium.common.exceptions.ElementNotInteractableException: Message: element not interactable
(Session info: chrome=88.0.4324.104)

if I iterate over all options, it doesn't return all options...

a = driver.find_element_by_class_name('form-control').find_elements_by_tag_name('option')
[print(i.get_attribute('value')) for i in a]

BS_TS documentation verification protocol BS_TS
technical acceptance certificate
Minutes of remarks
ACT of equipment and materials installation (signed)
BS project documentation

600d86bf62df1035877657.jpeg
600d86d28bae9295389475.jpeg

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
soremix, 2021-01-24
@SoreMix

driver.find_element_by_class_name('form-control').find_elements_by_tag_name('option')[1].clik()
AttributeError: 'WebElement' object has no attribute 'clik'

Check spelling of four letters - less than a second of life
Why do you think you've found the right select element ? Even in the screenshot, there are at least two elements with the form-control class .

I
Ivan Bogachev, 2017-06-16
@Alice777

Use another function (animation-timing-function):

везде_где_есть_эта_анимация {
    animation: flipOutRight 7s cubic-bezier(0,1,0,1);
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question