Interact with Dropdown elements using data driven testing in robot framework

61 views Asked by At

I'm currently implemenating Robot Framework for a web application testing. I need to interact with few dropdown elements. I want to save dropdowndown elements options in a CSV/Excel file. and then use one of the option in the testcase using that CSV/Excel file. I'm using selenium library and pycharm IDE.

I have already installed datadriver library and csv library. I tried the below block of code and multiple other options. but so far no success.

Any help would be appreciated. Need a starting point.

*** Test Cases ***

select option from dropdown
   
    Open my Browser
  
    ${dropdown_options}     Read Csv File To List     ${CSV File}
    ${selected_option} =      Get Random Element    ${dropdown_options}[1:]
    Log    Selected Option: ${selected_option}
    Select From List By Label    ${Dropdown Locator}    ${selected_option}
    Sleep    5

*** Variables ***

${Dropdown Locator}       //select[@id='plantSelector']

${CSV File}        dropdown_options.csv
0

There are 0 answers