On the webpage, there is a table containing 11 checkboxes.
I am looking to create a keyword that allows testers to input just 1, 2, or 3 to select a specific checkbox without needing multiple lines of element variables.
Here are the elements:
xpath=(//input[@class="ant-checkbox-input"])[1]
xpath=(//input[@class="ant-checkbox-input"])[2]
xpath=(//input[@class="ant-checkbox-input"])[3]
Current script:
*** Settings ***
Library Browser
*** Variables ***
${Checkbox-1} xpath=(//input[@class="ant-checkbox-input"])[1]
${Checkbox-2} xpath=(//input[@class="ant-checkbox-input"])[2]
${Checkbox-2} xpath=(//input[@class="ant-checkbox-input"])[3]
*** Test Cases ***
Click ${Checkbox-1}
Click ${Checkbox-2}
Click ${Checkbox-3}
Expected script:
*** Settings ***
Library Browser
*** Variables ***
${Checkbox-1} xpath=(//input[@class="ant-checkbox-input"])[1]
${Checkbox-2} xpath=(//input[@class="ant-checkbox-input"])[2]
${Checkbox-2} xpath=(//input[@class="ant-checkbox-input"])[3]
${CustomCheckbox} Constructing this variable
*** Test Cases ***
User selects checkboxes 1 and 2
[Arguments] ${not sure}
Click ${CustomCheckbox} 1 2
Outer HTML of the first row in the table:
<tr data-row-key="1" class="ant-table-row ant-table-row-level-0">
<td class="ant-table-cell ant-table-selection-column">
<label class="ant-checkbox-wrapper">
<span class="ant-checkbox">
<input type="checkbox" class="ant-checkbox-input" value="">
<span class="ant-checkbox-inner"/>
</span>
</label>
</td>
<td class="ant-table-cell">1</td>
<td class="ant-table-cell">101-39s5mb.mp4</td>
</tr>