Skip to content Skip to sidebar Skip to footer

Selenium Python - Selecting From A List On The Web With No Stored/embedded Options

I'm very new to Python so forgive me if this isn't completely comprehensible. I'm trying to select from a combobox in a webpage. All the examples I've seen online are choosing from

Solution 1:

Yes It is Possible to build drop down without using Select and Options tag which is available in HTML.

pseudocode :

elements = driver.find_elements_by_xpath("your xpath for drop down")

loop to iterate over this list

Inside loop if condition for a webelement like : webElement.getText().equals(" your value from drop down")

click on the element like element.click()

closure of if followed by closer of loop.

Solution 2:

This error message...

Select only works onselect elements, noton input

...implies that you have initialized a Select object and tried to pass an input tag to the Select object.

As per the HTML you have shared the desired object is within an <input> tag. So you can't assign the input tag to a Select instance. Instead to click and expand the selection box you can try the following code block :

driver.find_element_by_xpath("//span[@class='custom-combobox']/input[@class='custom-combobox-input ui-widget ui-widget-content ui-corner-left ui-autocomplete-input']")

Post a Comment for "Selenium Python - Selecting From A List On The Web With No Stored/embedded Options"