Skip to content


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 the option by value.

# Select the option with the text that is visible to the user.
// Not yet implemented.

Manipulating <input type="file"> elements

To select a file in an input of type file <input type="file>, use the method below:

# Get the element.
input_file = bot.find_element('file', By.ID)

# select the file.
bot.set_file_input_element(element=input_file, file_path='PATH_TO_FILE_HERE')
// Get the element.
WebElement fileInput = findElement("file"));

// Get the file
setFileInputElement(fileInput, new File("PATH_TO_FILE_HERE"));