Your ultimate guide

Handling Radio button and Checkbox using Robot Framework



Radio Button Keywords in SeleniumLibrary:

The following image contains the Source code of the radio button and its Output.
        


Note:  The radio button group must have shared the same name to be treated as a group and the value attribute defines the unique value associated with each radio button.
    group_name is the name of the group, and value is the id or value attribute of the actual radio button.

Select Radio Button: 
  • This keyword is used to select the radio button by using name and value/id attributes.
  • It contains Two Arguments group_name and value.
    Syntax:   Select Radio Button    group_name    value.
    Example: Select Radio Button    sex    Male 

Radio Button Should Be Set To: 
  • This keyword is used to check that a particular radio button should have been selected.
  • It contains Two Arguments group_name and value.
    Syntax: Radio Button Should Be Set To    group_name    value
    Example: Radio Button Should Be Set To    sex    Male

Radio Button Should Not Be Selected: 
  • This keyword is used to check any radio button in a group should not be selected. 
  • It contains only Argument group_name.
    Syntax: Radio Button Should Not Be Selected    group_name.
    Example: Radio Button Should Not Be Selected    sex

Page Should Contain Radio Button: check the radio button locator is found on the current page. 
    Syntax: Page Should Contain Radio Button        locator
    Example: Page Should Contain Radio Button        xpath://input[@value='Female']

Page Should Not Contain Radio Button: check if the radio button locator is not found on the current page.
    Syntax: Page Should Not Contain Radio Button        locator
    Example: Page Should Contain Radio Button        xpath://input[@value='Female21']

CheckBox Keyword in SeleniumLibrary:

Select Checkbox: This keyword is used to select the checkbox identified by the locator.
    Syntax:   Select Checkbox        locator

Unselect Checkbox: This keyword is used to remove the selection checkbox identified by the locator.
    Syntax:   Unselect Checkbox        locator

Checkbox Should Be Selected: This keyword is used to Verify the checkbox is selected.
    Syntax:   Checkbox Should Be Selected        locator

Checkbox Should Not Be Selected: This keyword is used to verify the checkbox is not selected.
    Syntax:   Checkbox Should Not Be Selected        locator

No comments:

Post a Comment