### Install and Build Example Source: https://github.com/marketsquare/robotframework-browser/blob/main/docs/examples/babelES2015/README.md Installs dependencies, builds the project, and shows documentation for the translated JavaScript extension. ```bash npm install npm run build python -m robot.libdoc Browser::jsextension=lib/index.js show funkkari ``` -------------------------------- ### Server Start Log Entry Source: https://github.com/marketsquare/robotframework-browser/blob/main/node/dynamic-test-app/README.md Example of a server start log entry, including timestamp and URL. ```json {"timestamp":"2025-07-01T12:00:00.000Z","event":"server_start","url":"http://localhost:7272"} ``` -------------------------------- ### Get Element State Example Source: https://github.com/marketsquare/robotframework-browser/blob/main/docs/versions/Browser-13.2.0.html An example of using the deprecated 'Get Element State' keyword to check the 'readonly' state of an element. ```robotframework Get Element State h1 readonly == False ``` -------------------------------- ### Starting a browser with a page Source: https://github.com/marketsquare/robotframework-browser/blob/main/docs/versions/Browser-1.3.0-dev.html Demonstrates the basic setup for launching a browser, configuring a context with a specific viewport, and opening a new page. This is useful for initial test setup or debugging. ```robotframework * Test Cases * Starting a browser with a page New Browser chromium headless=false New Context viewport={'width': 1920, 'height': 1080} New Page https://marketsquare.github.io/robotframework-browser/Browser.html Get Title == Browser ``` -------------------------------- ### Get Checkbox State Example Source: https://github.com/marketsquare/robotframework-browser/blob/main/docs/versions/Browser-7.0.0.html Example of how to get the state of a checkbox and assert its value. Strings are interpreted as booleans, with specific strings mapping to false. ```robotframework Get Checkbox State name=can_send_email == checked ``` -------------------------------- ### Starting a browser with a page Source: https://github.com/marketsquare/robotframework-browser/blob/main/docs/versions/Browser-2.3.3.html Demonstrates the typical workflow of opening a browser, setting up a context with a specific viewport, and navigating to a page. This is useful for initial setup or debugging. ```robotframework *** Test Cases *** Starting a browser with a page New Browser chromium headless=false New Context viewport={'width': 1920, 'height': 1080} New Page https://marketsquare.github.io/robotframework-browser/Browser.html Get Title == Browser ``` -------------------------------- ### Get Browser Catalog Source: https://github.com/marketsquare/robotframework-browser/blob/main/docs/versions/Browser-16.0.5.html Gets a list of browsers that are installed on the system. ```APIDOC ## Get Browser Catalog ### Description Gets a list of browsers that are installed on the system. ### Method GET ### Endpoint /browser/catalog ### Response #### Success Response (200) - **browsers** (array) - A list of browser objects, each containing 'name', 'version', and 'path'. ``` -------------------------------- ### Starting a browser with a page Source: https://github.com/marketsquare/robotframework-browser/blob/main/docs/versions/Browser-2.3.4.html Demonstrates the basic setup for starting a browser, creating a new context with a specified viewport, opening a new page, and verifying the page title. ```robotframework New Browser chromium headless=false New Context viewport={'width': 1920, 'height': 1080} New Page https://marketsquare.github.io/robotframework-browser/Browser.html Get Title == Browser ``` -------------------------------- ### Get Browser Catalog Source: https://github.com/marketsquare/robotframework-browser/blob/main/docs/versions/Browser-14.1.0.html Gets information about the browsers that are installed on the system. ```APIDOC ## Get Browser Catalog ### Description Gets information about the browsers that are installed on the system. ### Method GET ### Endpoint /get_browser_catalog ### Response #### Success Response (200) - **browsers** (list) - A list of available browsers. ``` -------------------------------- ### Starting a browser with a page Source: https://github.com/marketsquare/robotframework-browser/blob/main/docs/versions/Browser-1.5.0.html Demonstrates the typical workflow for starting a browser, setting up a context with a specific viewport, and opening a new page. This is useful for setting up test environments. ```robotframework *** Test Cases *** Starting a browser with a page New Browser chromium headless=false New Context viewport={'width': 1920, 'height': 1080} New Page https://marketsquare.github.io/robotframework-browser/Browser.html Get Title == Browser ``` -------------------------------- ### Example: Get Page Scroll Size by Height Source: https://github.com/marketsquare/robotframework-browser/blob/main/docs/versions/Browser-11.2.0.html Demonstrates how to get only the height of the page's scrollable size and log it. This example uses the 'height' key to filter the result. ```robotframework ${height}= Get Scroll Size height Log Width: ${height} ``` -------------------------------- ### Get Checkbox State Assertion Example Source: https://github.com/marketsquare/robotframework-browser/blob/main/docs/versions/Browser-19.7.0.html Example demonstrating how to assert the state of a checkbox using the 'Get Checkbox State' keyword. The assertion checks if the checkbox with the name 'can_send_email' is checked. ```robotframework Get Checkbox State name=can_send_email == checked ``` -------------------------------- ### Example of New Context with Device Source: https://github.com/marketsquare/robotframework-browser/blob/main/docs/versions/Browser-10.0.1.html This example demonstrates how to use 'Get Device' to retrieve device properties and then unpack them into 'New Context' to test a specific device like an iPhone X. ```robotframework Test an iPhone ${device}= Get Device iPhone X New Context &{device} # unpacking here with & New Page http://example.com ``` -------------------------------- ### Get Element State Refactoring Example (Assertion) Source: https://github.com/marketsquare/robotframework-browser/blob/main/docs/versions/Browser-14.4.0.html Demonstrates refactoring from Get Element State to Get Element States for assertion. ```robotframework - Get Element State h1 readonly == False + Get Element States h1 not contains readonly ``` -------------------------------- ### Open Browser Example Source: https://github.com/marketsquare/robotframework-browser/blob/main/docs/versions/Browser-19.12.5.html Open a new browser instance and navigate to a URL. Ensure the browser executable is in your system's PATH or specify its location. ```robotframework Open Browser http://example.com chrome ``` -------------------------------- ### Get Page Errors Example Source: https://github.com/marketsquare/robotframework-browser/blob/main/docs/versions/Browser-18.1.0.html This example shows the structure of error messages returned by the Get Page Errors keyword. It includes details on error name, message, stack trace, and timestamp. ```python { 'name': 'ReferenceError', 'message': 'YT is not defined', 'stack': 'ReferenceError: YT is not defined\\n at HTMLIFrameElement.onload (Keyword Selector Key Assertion Operator Assertion Expected Get Title equal Page Title Get Title ^= Page Get Style //*[@id="div-element"] width > 100 Get Title matches \\\\w+\\\\s\\\\w+ ``` -------------------------------- ### Open Browser Example Source: https://github.com/marketsquare/robotframework-browser/blob/main/docs/versions/Browser-19.8.0.html Open a new browser instance and navigate to a URL. Ensure to specify the browser type and whether to run in headless mode. ```robotframework Open Browser http://example.com chrome headless=true ``` -------------------------------- ### Get Element State Refactoring Example (Getting State) Source: https://github.com/marketsquare/robotframework-browser/blob/main/docs/versions/Browser-14.4.0.html Illustrates refactoring to use Get Element States for retrieving a specific element state. ```robotframework - ${visibility} Get Element State h1 visible + ${visibility} Get Element States h1 then bool(value & visible) # Returns ${True} if element is visible. ``` -------------------------------- ### Starting a browser with a page Source: https://github.com/marketsquare/robotframework-browser/blob/main/docs/versions/Browser-0.15.1.html Demonstrates how to open a new browser instance, configure its viewport, and navigate to a specific page. This is useful for setting up test environments. ```robotframework Starting a browser with a page New Browser chromium headless=false New Context viewport={'width': 1920, 'height': 1080} New Page https://marketsquare.github.io/robotframework-browser/Browser.html Get Title == Browser ``` -------------------------------- ### Get Scroll Position Example Source: https://github.com/marketsquare/robotframework-browser/blob/main/docs/versions/Browser-18.5.1.html Example of retrieving the scroll position of an element using the ScrollPosition type. ```robotframework Get Scroll Position css=.my_element ``` -------------------------------- ### Example Device Emulation for New Context Source: https://github.com/marketsquare/robotframework-browser/blob/main/docs/versions/Browser-2.4.0.html Demonstrates how to use the 'Get Device' keyword to retrieve device properties and then unpack them into the 'New Context' keyword to configure a new browser context for a specific device, such as an iPhone X. ```robotframework Test an iPhone ${device}= Get Device iPhone X New Context &{device} # unpacking here with & New Page http://example.com ``` -------------------------------- ### Install Browser library 1.7.0 Source: https://github.com/marketsquare/robotframework-browser/blob/main/docs/releasenotes/Browser-1.7.0.rst Use pip to install or upgrade the Browser library. Run `rfbrowser init` to initialize the library after installation. ```bash pip install --upgrade robotframework-browser rfbrowser init ``` ```bash pip install robotframework-browser==1.7.0 rfbrowser init ``` -------------------------------- ### Get Title Example Source: https://github.com/marketsquare/robotframework-browser/blob/main/docs/versions/Browser-19.12.5.html Get the title of the current page. This keyword is useful for verifying page content. ```robotframework Title Should Be Example Domain ``` -------------------------------- ### Setup Helper Arguments Source: https://github.com/marketsquare/robotframework-browser/blob/main/docs/versions/Browser-19.7.2.html Prepares arguments for a helper, including parameters and options. It can either return the options object or push it onto the stack. ```javascript setupHelperArgs:function(e,t,r,n){var o=this.setupParams(e,t,r);return(o.loc=JSON.stringify(this.source.currentLocation),o=this.objectLiteral(o),n)?(this.useRegister("options"),r.push("options"),\["options=",o\]):r?(r.push(o),"" ):o} ``` -------------------------------- ### Get Style Example Source: https://github.com/marketsquare/robotframework-browser/blob/main/docs/versions/Browser-10.0.2.html Gets computed style properties of an element. Supports assertions on the style values. ```robotframework Get Style selector key assertion_operator assertion_expected message ``` -------------------------------- ### Browser Library Keyword Examples Source: https://github.com/marketsquare/robotframework-browser/blob/main/docs/versions/Browser-0.16.0.html A collection of examples demonstrating various Browser library keywords for assertions, style checks, and title matching. ```robotframework # Exact match assertion Get Title equal Page Title # Starts with assertion Get Title ^= Page # Style assertion for width greater than 100 Get Style //*[@id="div-element"] width > 100 # Regex match assertion for title format Get Title matches \\w+\\s\\w+ ``` -------------------------------- ### Install Browser Library (Specific Version) Source: https://github.com/marketsquare/robotframework-browser/blob/main/docs/releasenotes/Browser-1.4.0.rst Use this command to install a specific version of the Browser library and initialize it. ```bash pip install robotframework-browser==1.4.0 rfbrowser init ``` -------------------------------- ### Install Latest Browser Library Source: https://github.com/marketsquare/robotframework-browser/blob/main/docs/releasenotes/Browser-10.0.1.rst Use this command to install the latest available version of the Browser library and initialize it. ```bash pip install --upgrade robotframework-browser rfbrowser init ``` -------------------------------- ### Refactoring Example: Get Element State to Get Element States Source: https://github.com/marketsquare/robotframework-browser/blob/main/docs/versions/Browser-14.3.0.html Illustrates refactoring from the deprecated 'Get Element State' to the recommended 'Get Element States' for asserting multiple element states. ```robotframework - Get Element State h1 readonly == False + Get Element States h1 not contains readonly ``` ```robotframework - Get Element State id=password visible == True - Get Element State id=password readonly == False - Get Element State id=password disabled == False + Get Element States h1 contains visible editable enabled ``` -------------------------------- ### Get Element State Refactoring Example Source: https://github.com/marketsquare/robotframework-browser/blob/main/docs/versions/Browser-14.2.1.html Demonstrates refactoring from the deprecated 'Get Element State' to 'Get Element States' for asserting multiple element states. ```robotframework Get Element State h1 readonly == False Get Element State h1 readonly == False Get Element State id=password visible == True Get Element State id=password readonly == False Get Element State id=password disabled == False ``` -------------------------------- ### Install and Initialize Browser Library Source: https://github.com/marketsquare/robotframework-browser/blob/main/docs/releasenotes/Browser-7.0.0.rst Use these commands to install or upgrade to the latest version of the Browser library and initialize it. For a specific version, replace 'latest' with the desired version number. ```bash pip install --upgrade robotframework-browser rfbrowser init ``` ```bash pip install robotframework-browser==7.0.0 rfbrowser init ``` -------------------------------- ### Get Element Locator Example Source: https://github.com/marketsquare/robotframework-browser/blob/main/docs/versions/Browser-13.0.0.html Demonstrates how to get a Playwright Locator for a given selector. This locator can be used for subsequent operations like getting element properties. ```robotframework ${element} = Get Element #username_field ${option_value} = Get Property ${element} >> optionOne value ${option_value} = Get Property ${element} >> optionTwo value ``` -------------------------------- ### Starting a browser with a page Source: https://github.com/marketsquare/robotframework-browser/blob/main/docs/versions/Browser-1.2.4.html Demonstrates the sequence of keywords to open a browser, configure a context with a specific viewport, and then open a new page. This is useful for setting up a controlled testing environment. ```robotframework New Browser chromium headless=false New Context viewport={'width': 1920, 'height': 1080} New Page https://marketsquare.github.io/robotframework-browser/Browser.html Get Title == Browser ``` -------------------------------- ### Get Selection Type Example Source: https://github.com/marketsquare/robotframework-browser/blob/main/docs/versions/Browser-18.5.1.html Example of specifying whether to return the active/current instance ID or all instance IDs. ```robotframework Get Browser ALL ``` -------------------------------- ### Install and Initialize Browser Library Source: https://github.com/marketsquare/robotframework-browser/blob/main/docs/releasenotes/Browser-5.0.0.rst Use pip to install or upgrade the Browser library and initialize it for use with Robot Framework. ```bash pip install --upgrade robotframework-browser rfbrowser init ``` ```bash pip install robotframework-browser==5.0.0 rfbrowser init ``` -------------------------------- ### Install Browser library Source: https://github.com/marketsquare/robotframework-browser/blob/main/docs/releasenotes/Browser-13.1.0.rst Use this command for a fresh installation of the latest Browser library release. ```bash pip install robotframework-browser rfbrowser init ``` -------------------------------- ### Example Page Error Source: https://github.com/marketsquare/robotframework-browser/blob/main/docs/versions/Browser-18.2.0.html An example of a single error message object as returned by the Get Page Errors keyword. ```json [ { 'name': 'ReferenceError', 'message': 'YT is not defined', 'stack': 'ReferenceError: YT is not defined\n at HTMLIFrameElement.onload (https://example.com/:20:2245)', 'time': '2023-02-05T20:08:48.912Z' } ] ``` -------------------------------- ### Setup Helper Arguments with Options Source: https://github.com/marketsquare/robotframework-browser/blob/main/docs/versions/Browser-19.9.0b2.html Prepares arguments for a helper, including generating an options object and potentially registering it. Returns an array suitable for function calls. ```javascript setupHelperArgs:function(e,t,r,n){var o=this.setupParams(e,t,r);return(o.loc=JSON.stringify(this.source.currentLocation),o=this.objectLiteral(o),n)?(this.useRegister("options"),r.push("options"),\["options=",o\]):r?(r.push(o)," "):o} ``` -------------------------------- ### Get Property of Element Source: https://github.com/marketsquare/robotframework-browser/blob/main/docs/versions/Browser-16.1.0.html Retrieves a specific property from an element. This example shows how to get the 'option value' property. ```robotframework ${option_value} = Get Property ${elem} >> option value ```