### Clone Robot Framework MCP Repository and Setup Source: https://github.com/sourcefuse/robotframework-mcp/blob/main/README.md Steps to clone the Robot Framework MCP repository for development or local setup. Includes creating a virtual environment and installing dependencies. ```bash # Clone the repository git clone https://github.com/sourcefuse/robotframework-MCP.git cd robotframework-MCP # Create virtual environment python3 -m venv .venv source .venv/bin/activate # On Windows: .venv\Scripts\activate # Install dependencies pip install -r requirements.txt # Run the MCP server directly python mcp_server.py ``` -------------------------------- ### Install Robot Framework MCP Server with PyPI Source: https://context7.com/sourcefuse/robotframework-mcp/llms.txt Install the server using pip and run it directly. Configure the MCP client with the server command and stdio type. ```bash pip3 install robotframework-mcp robotframework-mcp ``` ```json // mcp.json { "mcpServers": { "robotframework-mcp": { "command": "robotframework-mcp", "type": "stdio" } } } ``` -------------------------------- ### Install and Run Robot Framework MCP Server from PyPI Source: https://github.com/sourcefuse/robotframework-mcp/blob/main/README.md Install the robotframework-mcp package using pip and run the server. This method is straightforward for users who prefer PyPI installations. ```bash # Install the package pip3 install robotframework-mcp # Run the MCP server robotframework-mcp ``` -------------------------------- ### Install Robot Framework MCP Server by Cloning Source: https://context7.com/sourcefuse/robotframework-mcp/llms.txt Clone the repository, set up a virtual environment, install dependencies, and run the server locally. Configure the MCP client with the Python command and the path to the server script. ```bash git clone https://github.com/sourcefuse/robotframework-MCP.git cd robotframework-MCP python3 -m venv .venv && source .venv/bin/activate pip install -r requirements.txt python mcp_server.py ``` ```json { "servers": { "robotframework-mcp": { "command": "python", "args": ["/path/to/cloned/robotframework-MCP/mcp_server.py"], "type": "stdio" } } } ``` -------------------------------- ### Install UV for Robot Framework MCP Server Source: https://github.com/sourcefuse/robotframework-mcp/blob/main/README.md Instructions for installing the UV package manager, which can be used as an alternative to pip for managing Python environments and dependencies. ```bash # Install UV (choose one method) curl -LsSf https://astral.sh/uv/install.sh | sh # Unix/macOS # OR pip install uv # Any platform # OR on Windows PowerShell (as Administrator) powershell -c "irm https://astral.sh/uv/install.ps1 | iex" ``` -------------------------------- ### Install Robot Framework MCP Server with npx Source: https://context7.com/sourcefuse/robotframework-mcp/llms.txt Use this configuration for VS Code's MCP client when installing the server via npx. Ensure the project directory is correctly specified. ```json // .vscode/mcp.json { "servers": { "robotframework-mcp": { "command": "npx", "args": [ "-y", "git+https://github.com/sourcefuse/robotframework-MCP.git", "--project-dir=/path/to/your/project" ], "type": "stdio" } } } ``` -------------------------------- ### Configure Robot Framework MCP Server from PyPI for MCP Clients Source: https://github.com/sourcefuse/robotframework-mcp/blob/main/README.md Configure your MCP client (like VS Code) to connect to the Robot Framework MCP server installed via PyPI. This uses the 'stdio' type for communication. ```json { "mcpServers": { "robotframework-mcp": { "command": "robotframework-mcp", "type": "stdio" } } } ``` -------------------------------- ### Get Page Performance Metrics in Robot Framework Source: https://context7.com/sourcefuse/robotframework-mcp/llms.txt Retrieves page load and DOM ready times using JavaScript. These metrics can be used to assess website performance. The results are returned as a dictionary. ```robotframework # Get Page Performance Metrics # ${load_time}= Execute Javascript return window.performance.timing.loadEventEnd - window.performance.timing.navigationStart # ${dom_ready}= Execute Javascript return window.performance.timing.domContentLoadedEventEnd - window.performance.timing.navigationStart # ${metrics}= Create Dictionary load_time=${load_time} dom_ready=${dom_ready} # [Return] ${metrics} ``` -------------------------------- ### Generate API + UI Integration Test Source: https://github.com/sourcefuse/robotframework-mcp/blob/main/README.md Use `create_api_integration_test` to generate tests that combine API calls with UI interactions. Requires base URL, endpoint, and optionally the HTTP method (defaults to GET). ```python create_api_integration_test(base_url, endpoint, method="GET") ``` -------------------------------- ### Generate Robot Framework Login Test Case Source: https://context7.com/sourcefuse/robotframework-mcp/llms.txt Use this Python function to generate a complete Robot Framework login test case. It validates URLs, sanitizes credentials, and supports different selector template types. An example of a validation error is also shown. ```python # Tool call from an MCP client (e.g., VS Code Copilot Chat): # "Generate a login test for https://www.saucedemo.com using standard_user / secret_sauce" result = create_login_test_case( url="https://www.saucedemo.com", username="standard_user", password="secret_sauce", template_type="appLocator" # options: "appLocator" | "generic" | "bootstrap" ) # --- Generated output (save as login_test.robot) --- # *** Settings *** # Library SeleniumLibrary # # *** Variables *** # ${URL} https://www.saucedemo.com # ${USERNAME} standard_user # ${PASSWORD} secret_sauce # ${BROWSER} Chrome # # # Selector Variables # ${USERNAME_FIELD} id=user-name # ${PASSWORD_FIELD} id=password # ${LOGIN_BUTTON} id=login-button # ${SUCCESS_INDICATOR} xpath=//span[@class='title'] # # *** Test Cases *** # Login Test # [Documentation] Test login functionality for appLocator # [Tags] smoke login appLocator # Open Browser ${URL} ${BROWSER} # Maximize Browser Window # Input Text ${USERNAME_FIELD} ${USERNAME} # Input Text ${PASSWORD_FIELD} ${PASSWORD} # Click Button ${LOGIN_BUTTON} # Wait Until Page Contains Element ${SUCCESS_INDICATOR} 10s # Element Text Should Be ${SUCCESS_INDICATOR} Products # [Teardown] Close Browser # Validation error example: result = create_login_test_case(url="not-a-url", username="user", password="pass") # Returns: "# VALIDATION ERROR: URL must use http or https protocol: not-a-url\n# Please correct the input and try again." ``` -------------------------------- ### Configure Robot Framework MCP Server from Cloned Repository for MCP Clients Source: https://github.com/sourcefuse/robotframework-mcp/blob/main/README.md Configure MCP clients to connect to the Robot Framework MCP server when run directly from a cloned repository using Python. Requires specifying the path to mcp_server.py. ```json { "servers": { "robotframework-mcp": { "command": "python", "args": ["/path/to/cloned/robotframework-MCP/mcp_server.py"], "type": "stdio" } } } ``` -------------------------------- ### Configure Robot Framework MCP Server with Node.js from Cloned Repo Source: https://github.com/sourcefuse/robotframework-mcp/blob/main/README.md Configure MCP clients to use the Node.js wrapper from a cloned Robot Framework MCP repository. This is an alternative to running the Python script directly. ```json { "servers": { "robotframework-mcp": { "command": "node", "args": [ "/path/to/cloned/robotframework-MCP/bin/robotframework-mcp.js", "--project-dir=/path/to/your/project" ], "type": "stdio" } } } ``` -------------------------------- ### Robot Framework MCP Selector Configurations Source: https://context7.com/sourcefuse/robotframework-mcp/llms.txt Provides three pre-built selector configurations for 'appLocator', 'generic', and 'bootstrap' applications. Use these templates to avoid hardcoding element selectors in your tests. ```python from mcp_server import SELECTOR_CONFIGS # appLocator (default) — targets SauceDemo-style apps SELECTOR_CONFIGS["appLocator"] == { "username_field": "id=user-name", "password_field": "id=password", "login_button": "id=login-button", "success_indicator": "xpath=//span[@class='title']", "error_message": "xpath=//h3[@data-test='error']", "logout_button": "id=logout_sidebar_link" } ``` ```python # generic — standard HTML form selectors SELECTOR_CONFIGS["generic"] == { "username_field": "id=username", "password_field": "id=password", "login_button": "css=button[type='submit']", "success_indicator": "css=.dashboard", "error_message": "css=.error", "logout_button": "css=.logout" } ``` ```python # bootstrap — Bootstrap 4/5 component selectors SELECTOR_CONFIGS["bootstrap"] == { "username_field": "css=input[name='username']", "password_field": "css=input[name='password']", "login_button": "css=.btn-primary", "success_indicator": "css=.navbar-brand", "error_message": "css=.alert-danger", "logout_button": "css=.btn-outline-secondary" } ``` ```python # Usage: pass template_type name to any relevant tool result = create_login_test_case( url="https://myapp.com", username="admin", password="secret", template_type="bootstrap" # uses Bootstrap selectors above ) ``` -------------------------------- ### Configure Robot Framework MCP Server with UV Source: https://github.com/sourcefuse/robotframework-mcp/blob/main/README.md Configure your MCP client to use UV to run the Robot Framework MCP server. This involves specifying 'uv run' and the command to execute the server. ```json { "servers": { "robotframework-mcp": { "command": "uv", "args": [ "run", "--with", "git+https://github.com/sourcefuse/robotframework-MCP.git", "python", "-c", "import mcp_server; mcp_server.main()" ], "type": "stdio" } } } ``` -------------------------------- ### create_login_test_case Source: https://context7.com/sourcefuse/robotframework-mcp/llms.txt Generates a complete Robot Framework test case file for login functionality. It validates the URL, sanitizes credentials, and selects element selectors based on the provided template type. The function returns the full `.robot` file content as a string. ```APIDOC ## create_login_test_case(url, username, password, template_type) ### Description Generates a complete Robot Framework test case file for login functionality. Validates the URL (must use `http`/`https`), sanitizes credentials (max 100 chars, no dangerous characters), and selects the appropriate element selectors based on `template_type`. Returns the full `.robot` file content as a string. ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Method This is a function call within an MCP client context, not a direct HTTP method. ### Endpoint N/A (Function call) ### Request Example ```python # Tool call from an MCP client (e.g., VS Code Copilot Chat): # "Generate a login test for https://www.saucedemo.com using standard_user / secret_sauce" result = create_login_test_case( url="https://www.saucedemo.com", username="standard_user", password="secret_sauce", template_type="appLocator" # options: "appLocator" | "generic" | "bootstrap" ) ``` ### Response #### Success Response - **string**: The full content of the generated `.robot` file. #### Response Example ```robotframework *** Settings *** Library SeleniumLibrary *** Variables *** ${URL} https://www.saucedemo.com ${USERNAME} standard_user ${PASSWORD} secret_sauce ${BROWSER} Chrome # Selector Variables ${USERNAME_FIELD} id=user-name ${PASSWORD_FIELD} id=password ${LOGIN_BUTTON} id=login-button ${SUCCESS_INDICATOR} xpath=//span[@class='title'] *** Test Cases *** Login Test [Documentation] Test login functionality for appLocator [Tags] smoke login appLocator Open Browser ${URL} ${BROWSER} Maximize Browser Window Input Text ${USERNAME_FIELD} ${USERNAME} Input Text ${PASSWORD_FIELD} ${PASSWORD} Click Button ${LOGIN_BUTTON} Wait Until Page Contains Element ${SUCCESS_INDICATOR} 10s Element Text Should Be ${SUCCESS_INDICATOR} Products [Teardown] Close Browser ``` ### Error Handling #### Validation Error Example ```python result = create_login_test_case(url="not-a-url", username="user", password="pass") # Returns: "# VALIDATION ERROR: URL must use http or https protocol: not-a-url\n# Please correct the input and try again." ``` ``` -------------------------------- ### Generate Performance Monitoring Test Source: https://github.com/sourcefuse/robotframework-mcp/blob/main/README.md Create comprehensive performance testing scripts with metrics collection using `create_performance_monitoring_test`. ```python create_performance_monitoring_test() ``` -------------------------------- ### Generate Extended Selenium Keywords for Robot Framework Source: https://context7.com/sourcefuse/robotframework-mcp/llms.txt Generates extended Robot Framework keywords for advanced browser interactions. Includes screenshot capture (full page, element, timestamped, highlighted), page metadata retrieval (title, URL, source), window management (position, size, centering, switching), and browser performance/logging utilities. Returns the `.robot` file content as a string. ```python result = create_extended_selenium_keywords() ``` ```robotframework # --- Selected generated keywords (save as ExtendedKeywords.robot) --- # # Capture Screenshot With Timestamp # ${timestamp}= Get Current Date result_format=%Y%m%d_%H%M%S # ${filename}= Set Variable screenshot_${timestamp}.png # Capture Page Screenshot ${filename} # RETURN ${filename} # # Take Element Screenshot With Highlight # [Arguments] ${locator} ${filename}=highlighted_element.png # Wait Until Element Is Visible ${locator} 10s ``` -------------------------------- ### Generate Extended Selenium Keywords with Monitoring Source: https://github.com/sourcefuse/robotframework-mcp/blob/main/README.md Generate extended Selenium keywords that include capabilities for taking screenshots, performance monitoring, and window management. ```python create_extended_selenium_keywords() ``` -------------------------------- ### Configure Robot Framework MCP Server with npx Source: https://github.com/sourcefuse/robotframework-mcp/blob/main/README.md Add this configuration to your MCP client's mcp.json file to use the npx method for running the Robot Framework MCP server. This method is suitable for VS Code or VS Code Insiders. ```json { "servers": { "robotframework-mcp": { "command": "npx", "args": [ "-y", "git+https://github.com/sourcefuse/robotframework-MCP.git", "--project-dir=/path/to/your/project" //Optional- If you want to run the mcp for local virtual environment or specific project only ], "type": "stdio" } } } ``` -------------------------------- ### Generate Robot Framework Performance Test Suite Source: https://context7.com/sourcefuse/robotframework-mcp/llms.txt Generates a Robot Framework test suite for web performance testing. It includes keywords for collecting navigation timing, paint timing, JS heap memory, and resource loading counts, along with validation against thresholds and report generation. Requires `TEST_URL` variable. ```python result = create_performance_monitoring_test() # --- Generated output (save as performance_test.robot) --- # *** Variables *** # ${PERFORMANCE_THRESHOLD_LOAD} 3000 # 3 seconds # ${PERFORMANCE_THRESHOLD_INTERACTIVE} 2000 # 2 seconds # ${PERFORMANCE_THRESHOLD_PAINT} 1000 # 1 second # # *** Test Cases *** # Website Performance Test # [Tags] performance load-time metrics # Open Browser ${TEST_URL} chrome options=add_argument("--enable-precise-memory-info") # Wait Until Page Does Not Contain Loading timeout=30s # Sleep 2s # ${metrics}= Collect Performance Metrics # Validate Performance Thresholds ${metrics} # Test Page Interaction Performance # Generate Performance Report ${metrics} # Close Browser # # Collect Performance Metrics keyword gathers: # - Navigation timing: dns_lookup, tcp_connect, request_response, dom_processing, load_complete, dom_ready # - Paint timing: first_paint, first-contentful-paint # - Memory: used_js_heap, total_js_heap, heap_limit # - Resources: counts by type (script, img, css, fetch, etc.) + total # # Run with: # robot --variable TEST_URL:https://example.com performance_test.robot # # Expected console output: # ============================================================================== # Website Performance Test # ============================================================================== # Website Performance Test | PASS | # ------------------------------------------------------------------------------ # Performance report saved to: performance_report_2024-01-15_10-30-45.txt ``` -------------------------------- ### Generate Advanced Selenium Keywords for Robot Framework Source: https://context7.com/sourcefuse/robotframework-mcp/llms.txt Generates a comprehensive library of reusable Robot Framework keywords for common Selenium interactions. Includes dropdowns, checkboxes, file uploads, alerts, mouse operations, scrolling, window management, JavaScript, waits, tables, and form validation. Returns the `.robot` file content as a string. ```python result = create_advanced_selenium_keywords() ``` ```robotframework # --- Selected generated keywords (save as AdvancedKeywords.robot) --- # # Select Dropdown Option By Label # [Arguments] ${locator} ${label} # Wait Until Element Is Visible ${locator} 10s # Select From List By Label ${locator} ${label} # # Select Checkbox If Not Selected # [Arguments] ${locator} # 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} # # Upload File To Element # [Arguments] ${locator} ${file_path} # Wait Until Element Is Visible ${locator} 10s # Choose File ${locator} ${file_path} # # Get Alert Text And Accept # Alert Should Be Present # ${alert_text}= Get Alert Message # Accept Alert # RETURN ${alert_text} # # Scroll To Bottom Of Page # Execute JavaScript window.scrollTo(0, document.body.scrollHeight) # # Get Table Cell Text # [Arguments] ${table_locator} ${row} ${column} # ${cell_text}= Get Table Cell ${table_locator} ${row} ${column} # RETURN ${cell_text} ``` ```robotframework # Usage in a test: # *** Settings *** # Resource AdvancedKeywords.robot # # *** Test Cases *** # Form Interaction Test # Open Browser https://example.com/form Chrome # Select Dropdown Option By Label id=country United States # Select Checkbox If Not Selected id=agree-terms # Upload File To Element id=file-upload /path/to/document.pdf # Scroll To Bottom Of Page # ${row_count}= Get Table Row Count id=results-table # Log Found ${row_count} rows ``` -------------------------------- ### Generate Robot Framework Data-Driven Test Template Source: https://github.com/sourcefuse/robotframework-mcp/blob/main/README.md Create data-driven test templates with `create_data_driven_test`. Specify the test data file, defaulting to 'test_data.csv'. ```python create_data_driven_test(test_data_file="test_data.csv") ``` -------------------------------- ### Generate Robot Framework Login Test Case Source: https://github.com/sourcefuse/robotframework-mcp/blob/main/README.md Use the `create_login_test_case` tool to generate a validated Robot Framework login test. Supports configurable selectors and requires URL, username, and password. ```python create_login_test_case(url, username, password, template_type="appLocator") ``` -------------------------------- ### Generate Robot Framework Data-Driven Test Source: https://context7.com/sourcefuse/robotframework-mcp/llms.txt Generates a Robot Framework test suite using the `DataDriver` library to read test data from a CSV file. Each row in the CSV file becomes a parameterized test case. Requires a `login_test_data.csv` file. ```python result = create_data_driven_test(test_data_file="login_test_data.csv") # --- Generated output (save as data_driven_login.robot) --- # *** Settings *** # Library SeleniumLibrary # Library DataDriver login_test_data.csv encoding=utf-8 # Test Template Login Test Template # # *** Variables *** # ${BROWSER} Chrome # ${BASE_URL} https://www.appurl.com # # *** Test Cases *** # Login Test With ${username} And ${password} # [Tags] data-driven login # # *** Keywords *** # Login Test Template # [Arguments] ${username} ${password} ${expected_result} # Open Browser ${BASE_URL} ${BROWSER} # Maximize Browser Window # Input Text id=user-name ${username} # Input Text id=password ${password} # Click Button id=login-button # Run Keyword If '${expected_result}' == 'success' # ... Wait Until Page Contains Element xpath=//span[@class='title'] 10s # ... ELSE # ... Wait Until Page Contains Element xpath=//h3[@data-test='error'] 10s ``` -------------------------------- ### Switch To Window By Title in Robot Framework Source: https://context7.com/sourcefuse/robotframework-mcp/llms.txt Switches to a browser window based on its title. It iterates through all open windows, switches to each, and checks its title. If no window matches the title, the test fails. ```robotframework # Switch To Window By Title # [Arguments] ${expected_title} # @{windows}= Get Window Handles # FOR ${window} IN @{windows} # Switch Window ${window} # ${title}= Get Title # IF '${title}' == '${expected_title}' # RETURN # END # END # Fail Window with title '${expected_title}' not found ``` -------------------------------- ### Generate Robot Framework Login Page Object Source: https://context7.com/sourcefuse/robotframework-mcp/llms.txt Generates a Robot Framework page object model for login pages. Configure element selectors based on the application template. Returns the `.robot` file content as a string. ```python result = create_page_object_login(template_type="generic") ``` ```robotframework # *** Settings *** # Library SeleniumLibrary # # *** Variables *** # # GENERIC Application Selectors # ${LOGIN_USERNAME_FIELD} id=username # ${LOGIN_PASSWORD_FIELD} id=password # ${LOGIN_BUTTON} css=button[type='submit'] # ${LOGIN_ERROR_MESSAGE} css=.error # # *** Keywords *** # Input Username # [Arguments] ${username} # Wait Until Element Is Visible ${LOGIN_USERNAME_FIELD} # Clear Element Text ${LOGIN_USERNAME_FIELD} # Input Text ${LOGIN_USERNAME_FIELD} ${username} # # Login With Credentials # [Arguments] ${username} ${password} # Input Username ${username} # Input Password ${password} # Click Login Button # # Verify Error Message # [Arguments] ${expected_message} # Wait Until Element Is Visible ${LOGIN_ERROR_MESSAGE} 10s # Element Text Should Be ${LOGIN_ERROR_MESSAGE} ${expected_message} ``` ```robotframework # Usage in a test file that imports this POM: # *** Settings *** # Resource LoginPage.robot # # *** Test Cases *** # Valid Login # Open Browser https://example.com Chrome # Login With Credentials admin secret # # Invalid Login Shows Error # Open Browser https://example.com Chrome # Login With Credentials bad_user wrong_pass # Verify Error Message Epic sadface: Username and password do not match ``` -------------------------------- ### Performance & Monitoring Source: https://github.com/sourcefuse/robotframework-mcp/blob/main/README.md Function for generating performance testing configurations. ```APIDOC ## create_performance_monitoring_test ### Description Generate comprehensive performance testing configurations with metrics collection. ### Method Signature `create_performance_monitoring_test()` ### Parameters None ### Request Example ```json { "operation": "create_performance_monitoring_test" } ``` ### Response (Details not provided in source) ``` -------------------------------- ### Validate Robot Framework Syntax Source: https://github.com/sourcefuse/robotframework-mcp/blob/main/README.md Validate Robot Framework code syntax and receive suggestions for improvements using the `validate_robot_framework_syntax` tool. Requires the Robot Framework code as a string. ```python validate_robot_framework_syntax(robot_code) ``` -------------------------------- ### create_api_integration_test Source: https://context7.com/sourcefuse/robotframework-mcp/llms.txt Generates a Robot Framework test that validates both the REST API response and the corresponding UI state in the same test run. Uses RequestsLibrary for HTTP calls and SeleniumLibrary for browser validation. Validates the base_url before generating code. Returns .robot file content as a string. ```APIDOC ## `create_api_integration_test(base_url, endpoint, method)` Generates a Robot Framework test that validates both the REST API response and the corresponding UI state in the same test run. Uses `RequestsLibrary` for HTTP calls and `SeleniumLibrary` for browser validation. Validates the `base_url` before generating code. Returns `.robot` file content as a string. ### Parameters - **base_url** (string) - The base URL for the API. - **endpoint** (string) - The API endpoint to test. - **method** (string) - The HTTP method to use (e.g., GET, POST). ### Returns - **string**: The content of the generated `.robot` file. ### Example ```python result = create_api_integration_test( base_url="https://jsonplaceholder.typicode.com", endpoint="/posts/1", method="GET" ) # --- Generated output (save as api_integration_test.robot) --- # *** Settings *** # Library SeleniumLibrary # Library RequestsLibrary # Library Collections # # *** Variables *** # ${BASE_URL} https://jsonplaceholder.typicode.com # ${API_ENDPOINT} /posts/1 # ${BROWSER} Chrome # # *** Test Cases *** # API UI Integration Test # [Tags] integration api ui # Create Session api_session ${BASE_URL} # ${api_response}= GET On Session api_session ${API_ENDPOINT} # Status Should Be 200 ${api_response} # ${response_data}= Set Variable ${api_response.json()} # Open Browser ${BASE_URL} ${BROWSER} # Maximize Browser Window # Wait Until Page Contains ${response_data['title']} 10s # Page Should Contain ${response_data['description']} # [Teardown] Run Keywords # ... Close Browser AND # ... Delete All Sessions # # *** Keywords *** # Validate API Response Structure # [Arguments] ${response} # Dictionary Should Contain Key ${response} id # Dictionary Should Contain Key ${response} title # Dictionary Should Contain Key ${response} description ``` ### Validation Error Example ```python result = create_api_integration_test(base_url="ftp://bad-url.com", endpoint="/api") # Returns: "# VALIDATION ERROR: URL must use http or https protocol: ftp://bad-url.com\n# ..." ``` ``` -------------------------------- ### Generate Robot Framework API Integration Test Source: https://context7.com/sourcefuse/robotframework-mcp/llms.txt Generates a Robot Framework test file that validates both API responses and UI state. Requires SeleniumLibrary and RequestsLibrary. Validates the base URL protocol. ```python result = create_api_integration_test( base_url="https://jsonplaceholder.typicode.com", endpoint="/posts/1", method="GET" ) ``` ```robotframework # *** Settings *** # Library SeleniumLibrary # Library RequestsLibrary # Library Collections # # *** Variables *** # ${BASE_URL} https://jsonplaceholder.typicode.com # ${API_ENDPOINT} /posts/1 # ${BROWSER} Chrome # # *** Test Cases *** # API UI Integration Test # [Tags] integration api ui # Create Session api_session ${BASE_URL} # ${api_response}= GET On Session api_session ${API_ENDPOINT} # Status Should Be 200 ${api_response} # ${response_data}= Set Variable ${api_response.json()} # Open Browser ${BASE_URL} ${BROWSER} # Maximize Browser Window # Wait Until Page Contains ${response_data['title']} 10s # Page Should Contain ${response_data['description']} # [Teardown] Run Keywords # ... Close Browser AND # ... Delete All Sessions # # *** Keywords *** # Validate API Response Structure # [Arguments] ${response} # Dictionary Should Contain Key ${response} id # Dictionary Should Contain Key ${response} title # Dictionary Should Contain Key ${response} description ``` ```python result = create_api_integration_test(base_url="ftp://bad-url.com", endpoint="/api") ``` ```text # Returns: "# VALIDATION ERROR: URL must use http or https protocol: ftp://bad-url.com\n# ..." ``` -------------------------------- ### Advanced Keywords Source: https://github.com/sourcefuse/robotframework-mcp/blob/main/README.md Functions for generating advanced and extended SeleniumLibrary keywords. ```APIDOC ## create_advanced_selenium_keywords ### Description Generate advanced SeleniumLibrary keywords for common web interactions like dropdowns, checkboxes, file uploads, and alerts. ### Method Signature `create_advanced_selenium_keywords()` ### Parameters None ### Request Example ```json { "operation": "create_advanced_selenium_keywords" } ``` ### Response (Details not provided in source) ``` ```APIDOC ## create_extended_selenium_keywords ### Description Generate extended Selenium keywords including capabilities for screenshots, performance monitoring, and window management. ### Method Signature `create_extended_selenium_keywords()` ### Parameters None ### Request Example ```json { "operation": "create_extended_selenium_keywords" } ``` ### Response (Details not provided in source) ``` -------------------------------- ### Generate Robot Framework Login Page Object Model Source: https://github.com/sourcefuse/robotframework-mcp/blob/main/README.md Generate a page object model for login functionality using `create_page_object_login`. Supports configurable selectors via `template_type`. ```python create_page_object_login(template_type="appLocator") ``` -------------------------------- ### Generate Advanced Selenium Keywords Source: https://github.com/sourcefuse/robotframework-mcp/blob/main/README.md Generate a set of advanced SeleniumLibrary keywords for common web interactions like handling dropdowns, checkboxes, file uploads, and alerts. ```python create_advanced_selenium_keywords() ``` -------------------------------- ### InputValidator: URL, Credential, and Selector Validation Source: https://context7.com/sourcefuse/robotframework-mcp/llms.txt Provides static methods for validating URLs, credentials, and selectors. Raises ValidationError on invalid input, which is caught and reported as a comment string. ```python from mcp_server import InputValidator, ValidationError # URL validation url = InputValidator.validate_url("https://myapp.example.com/login") ``` ```text # Returns: "https://myapp.example.com/login" ``` ```python try: InputValidator.validate_url("ftp://bad-protocol.com") except ValidationError as e: print(e) # URL must use http or https protocol: ftp://bad-protocol.com ``` ```python # Credential validation username, password = InputValidator.validate_credentials("john_doe", "P@ssw0rd") ``` ```text # Returns: ("john_doe", "P@ssw0rd") ``` ```python try: InputValidator.validate_credentials("user", "pass") except ValidationError as e: print(e) # Credentials contain invalid character: < ``` ```python # Selector validation selector = InputValidator.validate_selector("id=login-button") ``` ```text # Returns: "id=login-button" ``` ```python selector = InputValidator.validate_selector("xpath=//div[@class='modal']") ``` -------------------------------- ### Validate Selector Input Source: https://context7.com/sourcefuse/robotframework-mcp/llms.txt Demonstrates validation of an empty selector string, which should raise a ValidationError. Ensure selectors are not empty before use. ```python try: InputValidator.validate_selector("") except ValidationError as e: print(e) # Selector cannot be empty ``` -------------------------------- ### Validation & Syntax Source: https://github.com/sourcefuse/robotframework-mcp/blob/main/README.md Function for validating Robot Framework syntax. ```APIDOC ## validate_robot_framework_syntax ### Description Validate Robot Framework syntax and provide suggestions for improvement. ### Method Signature `validate_robot_framework_syntax(robot_code)` ### Parameters - **robot_code** (string) - The Robot Framework code to validate. ### Request Example ```json { "robot_code": "*** Settings ***\nLibrary SeleniumLibrary\n\n*** Test Cases ***\nMy Test Case\n Open Browser http://example.com chrome" } ``` ### Response (Details not provided in source) ``` -------------------------------- ### Validate Robot Framework Syntax Source: https://context7.com/sourcefuse/robotframework-mcp/llms.txt Checks Robot Framework code for syntax errors like malformed headers, unclosed variables, and incorrect spacing. Returns a detailed report of errors and warnings. ```python # Example: valid code robot_code_valid = """ *** Settings *** Library SeleniumLibrary *** Variables *** ${URL} https://example.com *** Test Cases *** My Test Open Browser ${URL} Chrome [Teardown] Close Browser """ result = validate_robot_framework_syntax(robot_code_valid) ``` ```text # Returns: # # ROBOT FRAMEWORK SYNTAX VALIDATION # ✅ VALIDATION PASSED: No syntax errors found ``` ```python # Example: code with errors and warnings robot_code_bad = """ *** Settings ** Library SeleniumLibrary *** Variables *** ${URL} https://example.com *** Test Cases *** Bad Test Open Browser ${URL Chrome Log ${{message}} """ result = validate_robot_framework_syntax(robot_code_bad) ``` ```text # Returns: # # ROBOT FRAMEWORK SYNTAX VALIDATION # # ## ERRORS (Must Fix): # - Line 1: Section header must end with '***' # - Line 9: Unclosed variable syntax # # ## WARNINGS (Recommended Fixes): # - Line 10: Use ${variable} syntax instead of ${{variable}} # # ❌ VALIDATION FAILED: Critical errors found that must be fixed ``` -------------------------------- ### validate_robot_framework_syntax Source: https://context7.com/sourcefuse/robotframework-mcp/llms.txt Validates Robot Framework .robot file content passed as a string. Checks for malformed section headers, unclosed variable syntax, incorrect double-brace variables, and missing spacing in variable definitions. Returns a formatted validation report string with categorized errors and warnings. ```APIDOC ## `validate_robot_framework_syntax(robot_code)` Validates Robot Framework `.robot` file content passed as a string. Checks for malformed section headers (must end with `***`), unclosed variable syntax (`${` without `}`), incorrect double-brace variables (`${{variable}}`), and missing spacing in variable definitions. Returns a formatted validation report string with categorized errors and warnings. ### Parameters - **robot_code** (string) - The Robot Framework code to validate. ### Returns - **string**: A formatted validation report string. ### Example (Valid Code) ```python robot_code_valid = """ *** Settings *** Library SeleniumLibrary *** Variables *** ${URL} https://example.com *** Test Cases *** My Test Open Browser ${URL} Chrome [Teardown] Close Browser """ result = validate_robot_framework_syntax(robot_code_valid) # Returns: # # ROBOT FRAMEWORK SYNTAX VALIDATION # ✅ VALIDATION PASSED: No syntax errors found ``` ### Example (Code with Errors and Warnings) ```python robot_code_bad = """ *** Settings ** Library SeleniumLibrary *** Variables *** ${URL} https://example.com *** Test Cases *** Bad Test Open Browser ${URL Chrome Log ${{message}} """ result = validate_robot_framework_syntax(robot_code_bad) # Returns: # # ROBOT FRAMEWORK SYNTAX VALIDATION # # ## ERRORS (Must Fix): # - Line 1: Section header must end with '***' # - Line 9: Unclosed variable syntax # # ## WARNINGS (Recommended Fixes): # - Line 10: Use ${variable} syntax instead of ${{variable}} # # ❌ VALIDATION FAILED: Critical errors found that must be fixed ``` ``` -------------------------------- ### Core Test Generation Source: https://github.com/sourcefuse/robotframework-mcp/blob/main/README.md Functions for generating various types of Robot Framework test cases and page objects. ```APIDOC ## create_login_test_case ### Description Generate validated login test with configurable selectors. ### Method Signature `create_login_test_case(url, username, password, template_type="appLocator")` ### Parameters - **url** (string) - The URL for the login page. - **username** (string) - The username for login. - **password** (string) - The password for login. - **template_type** (string, optional) - The type of template to use for selectors. Defaults to "appLocator". ### Request Example ```json { "url": "https://example.com/login", "username": "testuser", "password": "password123", "template_type": "appLocator" } ``` ### Response (Details not provided in source) ``` ```APIDOC ## create_page_object_login ### Description Generate login page object model with validation. ### Method Signature `create_page_object_login(template_type="appLocator")` ### Parameters - **template_type** (string, optional) - The type of template to use for selectors. Defaults to "appLocator". ### Request Example ```json { "template_type": "appLocator" } ``` ### Response (Details not provided in source) ``` ```APIDOC ## create_data_driven_test ### Description Generate data-driven test templates. ### Method Signature `create_data_driven_test(test_data_file="test_data.csv")` ### Parameters - **test_data_file** (string, optional) - The CSV file containing test data. Defaults to "test_data.csv". ### Request Example ```json { "test_data_file": "test_data.csv" } ``` ### Response (Details not provided in source) ``` ```APIDOC ## create_api_integration_test ### Description Generate API + UI integration tests. ### Method Signature `create_api_integration_test(base_url, endpoint, method="GET")` ### Parameters - **base_url** (string) - The base URL for the API. - **endpoint** (string) - The API endpoint to test. - **method** (string, optional) - The HTTP method to use. Defaults to "GET". ### Request Example ```json { "base_url": "https://api.example.com", "endpoint": "/users", "method": "GET" } ``` ### Response (Details not provided in source) ``` -------------------------------- ### InputValidator Source: https://context7.com/sourcefuse/robotframework-mcp/llms.txt Provides static methods for validating URLs, credentials, and selectors, used internally by MCP tools to sanitize inputs before code generation. ```APIDOC ## `InputValidator` — URL, Credential, and Selector Validation The `InputValidator` class provides static methods used internally by all tools to sanitize inputs before code generation. All tools call these validators and return a `# VALIDATION ERROR:` comment string (rather than raising an exception to the MCP client) when validation fails. ### `validate_url(url)` Validates a URL string. Ensures the URL uses `http` or `https` protocol. - **Parameters**: - **url** (string): The URL to validate. - **Returns**: - **string**: The validated URL if it's valid. - **Raises**: - **ValidationError**: If the URL protocol is invalid. ### `validate_credentials(username, password)` Validates username and password strings. Checks for invalid characters. - **Parameters**: - **username** (string): The username to validate. - **password** (string): The password to validate. - **Returns**: - **tuple**: A tuple containing the validated username and password. - **Raises**: - **ValidationError**: If credentials contain invalid characters. ### `validate_selector(selector)` Validates a selector string. Supports formats like `id=...` or `xpath=...`. - **Parameters**: - **selector** (string): The selector string to validate. - **Returns**: - **string**: The validated selector string. ### Example Usage ```python from mcp_server import InputValidator, ValidationError # URL validation try: url = InputValidator.validate_url("https://myapp.example.com/login") print(f"Validated URL: {url}") InputValidator.validate_url("ftp://bad-protocol.com") except ValidationError as e: print(f"URL Validation Error: {e}") # Credential validation try: username, password = InputValidator.validate_credentials("john_doe", "P@ssw0rd") print(f"Validated Credentials: {username}, {password}") InputValidator.validate_credentials("user", "pass") except ValidationError as e: print(f"Credential Validation Error: {e}") # Selector validation try: selector_id = InputValidator.validate_selector("id=login-button") print(f"Validated Selector (ID): {selector_id}") selector_xpath = InputValidator.validate_selector("xpath=//div[@class='modal']") print(f"Validated Selector (XPath): {selector_xpath}") except ValidationError as e: print(f"Selector Validation Error: {e}") ``` ``` -------------------------------- ### Execute JavaScript in Robot Framework Source: https://context7.com/sourcefuse/robotframework-mcp/llms.txt Executes JavaScript code within the browser context. Useful for direct DOM manipulation or accessing browser APIs not exposed by standard SeleniumLibrary keywords. Ensure the locator is valid and the JavaScript code is correct. ```robotframework # Execute JavaScript arguments[0].style.border = '3px solid red'; ARGUMENTS ${locator} ``` ```robotframework # Execute JavaScript arguments[0].style.border = ''; ARGUMENTS ${locator} ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.