Skip to main content
Glama
sourcefuse

Robot Framework MCP Server

by sourcefuse

create_advanced_selenium_keywords

Generate Robot Framework keywords for advanced Selenium web testing operations. Creates .robot file content with SeleniumLibrary capabilities for test automation.

Instructions

Generate Robot Framework keywords for advanced Selenium operations. Returns .robot file content as text - does not execute.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The core handler function for the 'create_advanced_selenium_keywords' tool. Decorated with @mcp.tool(), it returns a multi-line template string containing advanced Robot Framework SeleniumLibrary keywords for operations like dropdowns, checkboxes, file uploads, alerts, mouse actions, scrolling, window management, JavaScript execution, waits, tables, and form validation.
    def create_advanced_selenium_keywords() -> str:
        """Generate Robot Framework keywords for advanced Selenium operations. Returns .robot file content as text - does not execute."""
        template = """*** Settings ***
    Library    SeleniumLibrary
    
    *** Keywords ***
    # Dropdown/Select Operations
    Select Dropdown Option By Label
        [Arguments]    ${locator}    ${label}
        [Documentation]    Select option from dropdown by visible text
        Wait Until Element Is Visible    ${locator}    10s
        Select From List By Label    ${locator}    ${label}
    
    Select Dropdown Option By Value
        [Arguments]    ${locator}    ${value}
        [Documentation]    Select option from dropdown by value
        Wait Until Element Is Visible    ${locator}    10s
        Select From List By Value    ${locator}    ${value}
    
    # Checkbox Operations
    Select Checkbox If Not Selected
        [Arguments]    ${locator}
        [Documentation]    Select checkbox only if it's not already selected
        Wait Until Element Is Visible    ${locator}    10s
        ${is_selected}=    Run Keyword And Return Status    Checkbox Should Be Selected    ${locator}
        Run Keyword If    not ${is_selected}    Select Checkbox    ${locator}
    
    Unselect Checkbox If Selected
        [Arguments]    ${locator}
        [Documentation]    Unselect checkbox only if it's currently selected
        Wait Until Element Is Visible    ${locator}    10s
        ${is_selected}=    Run Keyword And Return Status    Checkbox Should Be Selected    ${locator}
        Run Keyword If    ${is_selected}    Unselect Checkbox    ${locator}
    
    # File Upload Operations
    Upload File To Element
        [Arguments]    ${locator}    ${file_path}
        [Documentation]    Upload file using file input element
        Wait Until Element Is Visible    ${locator}    10s
        Choose File    ${locator}    ${file_path}
    
    # Alert/Pop-up Operations
    Handle Alert And Accept
        [Documentation]    Handle JavaScript alert and accept it
        Alert Should Be Present
        Accept Alert
    
    Handle Alert And Dismiss
        [Documentation]    Handle JavaScript alert and dismiss it
        Alert Should Be Present
        Dismiss Alert
    
    Get Alert Text And Accept
        [Documentation]    Get alert text and accept the alert
        Alert Should Be Present
        ${alert_text}=    Get Alert Message
        Accept Alert
        RETURN    ${alert_text}
    
    # Mouse Operations
    Hover Over Element
        [Arguments]    ${locator}
        [Documentation]    Hover mouse over an element
        Wait Until Element Is Visible    ${locator}    10s
        Mouse Over    ${locator}
    
    Double Click On Element
        [Arguments]    ${locator}
        [Documentation]    Double click on an element
        Wait Until Element Is Visible    ${locator}    10s
        Double Click Element    ${locator}
    
    Right Click On Element
        [Arguments]    ${locator}
        [Documentation]    Right click on an element
        Wait Until Element Is Visible    ${locator}    10s
        Open Context Menu    ${locator}
    
    # Scroll Operations
    Scroll To Element
        [Arguments]    ${locator}
        [Documentation]    Scroll element into view
        Wait Until Element Is Visible    ${locator}    10s
        Scroll Element Into View    ${locator}
    
    Scroll To Bottom Of Page
        [Documentation]    Scroll to the bottom of the page
        Execute JavaScript    window.scrollTo(0, document.body.scrollHeight)
    
    Scroll To Top Of Page
        [Documentation]    Scroll to the top of the page
        Execute JavaScript    window.scrollTo(0, 0)
    
    # Window/Tab Operations
    Switch To New Window
        [Documentation]    Switch to the newly opened window/tab
        ${current_windows}=    Get Window Handles
        ${window_count}=    Get Length    ${current_windows}
        Should Be True    ${window_count} > 1    New window should be opened
        Switch Window    ${current_windows}[-1]
    
    Close Current Window And Switch Back
        [Documentation]    Close current window and switch to previous one
        Close Window
        Switch Window    MAIN
    
    # JavaScript Operations
    Execute Custom JavaScript
        [Arguments]    ${javascript_code}
        [Documentation]    Execute custom JavaScript code
        ${result}=    Execute JavaScript    ${javascript_code}
        RETURN    ${result}
    
    Set Element Attribute
        [Arguments]    ${locator}    ${attribute}    ${value}
        [Documentation]    Set attribute value of an element using JavaScript
        Wait Until Element Is Visible    ${locator}    10s
        Execute JavaScript    arguments[0].setAttribute('${attribute}', '${value}');    ARGUMENTS    ${locator}
    
    Get Element Attribute Value
        [Arguments]    ${locator}    ${attribute}
        [Documentation]    Get attribute value of an element
        Wait Until Element Is Visible    ${locator}    10s
        ${value}=    Get Element Attribute    ${locator}    ${attribute}
        RETURN    ${value}
    
    # Advanced Wait Operations
    Wait Until Element Contains Text
        [Arguments]    ${locator}    ${expected_text}    ${timeout}=10s
        [Documentation]    Wait until element contains specific text
        Wait Until Element Is Visible    ${locator}    ${timeout}
        Wait Until Element Contains    ${locator}    ${expected_text}    ${timeout}
    
    Wait Until Page Title Contains
        [Arguments]    ${expected_title}    ${timeout}=10s
        [Documentation]    Wait until page title contains expected text
        Wait Until Title Contains    ${expected_title}    ${timeout}
    
    Wait For Element To Disappear
        [Arguments]    ${locator}    ${timeout}=10s
        [Documentation]    Wait for element to disappear from page
        Wait Until Element Is Not Visible    ${locator}    ${timeout}
    
    # Table Operations
    Get Table Cell Text
        [Arguments]    ${table_locator}    ${row}    ${column}
        [Documentation]    Get text from specific table cell
        ${cell_text}=    Get Table Cell    ${table_locator}    ${row}    ${column}
        RETURN    ${cell_text}
    
    Get Table Row Count
        [Arguments]    ${table_locator}
        [Documentation]    Get number of rows in table
        ${row_count}=    Get Element Count    ${table_locator}//tr
        RETURN    ${row_count}
    
    # Form Validation
    Verify Field Is Required
        [Arguments]    ${locator}
        [Documentation]    Verify field has required attribute
        ${is_required}=    Get Element Attribute    ${locator}    required
        Should Not Be Empty    ${is_required}    Field should be required
    
    Verify Field Is Disabled
        [Arguments]    ${locator}
        [Documentation]    Verify field is disabled
        Element Should Be Disabled    ${locator}
    
    Verify Field Is Enabled
        [Arguments]    ${locator}
        [Documentation]    Verify field is enabled
        Element Should Be Enabled    ${locator}
    """
        return template
  • mcp_server.py:233-233 (registration)
    The @mcp.tool() decorator registers this function as an MCP tool named 'create_advanced_selenium_keywords'.
    @mcp.tool()

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/sourcefuse/robotframework-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server