Forms¶
Manipulating <select> elements¶
To manipulate <select> elements, use the method below:
# Import element_as_select function.
from botcity.web.util import element_as_select
# Get the element.
select_element = bot.find_element(selector='select', by=By.ID)
# Converting the element to a select element.
select_element = element_as_select(select_element)
# Select the option by index.
select_element.select_by_index(index=0)
# Select the option by value.
select_element.select_by_value(value='ABC')
# Select the option with the text that is visible to the user.
select_element.select_by_visible_text(text='ABC')
Manipulating <input type="file"> elements¶
To select a file in an input of type file <input type="file>, use the method below: