### Install robotframework-browser-migration Source: https://context7.com/snooz82/robotframework-browser-migration/llms.txt Install the migration toolkit and the Browser library, then initialize the Browser library. ```bash pip install robotframework-browser-migration pip install robotframework-browser rfbrowser init ``` -------------------------------- ### Install robotframework-browser-migration Source: https://github.com/snooz82/robotframework-browser-migration/blob/master/Readme.md Install the migration layer library using pip. ```bash pip install robotframework-browser-migration ``` -------------------------------- ### Install and Initialize Browser Library Source: https://github.com/snooz82/robotframework-browser-migration/blob/master/Readme.md Install the Browser library and initialize it. This is required if you want to use the supported keywords information. ```bash pip install robotframework-browser ``` ```bash rfbrowser init ``` -------------------------------- ### Import SeleniumLibraryToBrowser Library Source: https://github.com/snooz82/robotframework-browser-migration/blob/master/doc/index.html Import the SeleniumLibraryToBrowser library in your Robot Framework test suites. This is a basic example; refer to the Migration Guide for more detailed import instructions. ```robotframework *** Settings *** Library SeleniumLibraryToBrowser ``` -------------------------------- ### Get Browser Aliases Example Source: https://github.com/snooz82/robotframework-browser-migration/blob/master/doc/index.html Demonstrates how to get and use aliases of active browsers. Aliases are returned as a NormalizedDict, accessible by key or as a list. This feature is new in SeleniumLibrary 4.0. ```Robot Framework &{aliases} Get Browser Aliases Log ${aliases.BrowserA} FOR ${alias} IN @{aliases} Log ${alias} END ``` -------------------------------- ### Open Browser Basic Usage Source: https://github.com/snooz82/robotframework-browser-migration/blob/master/doc/index.html Basic examples of the 'Open Browser' keyword with different browsers and configurations. ```robotframework Open Browser http://example.com Chrome ``` ```robotframework Open Browser http://example.com Firefox alias=Firefox ``` ```robotframework Open Browser http://example.com Edge remote_url=http://127.0.0.1:4444/wd/hub ``` ```robotframework Open Browser about:blank ``` ```robotframework Open Browser browser=Chrome ``` -------------------------------- ### Set Window Size Example Source: https://github.com/snooz82/robotframework-browser-migration/blob/master/doc/index.html Sets the current window size to the specified width and height. This is a direct equivalent to SeleniumLibrary's Set Window Size. ```robotframework *** Settings *** Library Browser *** Test Cases *** Set Window Size Example New Browser chromium headless=true New Page https://example.com Set Window Size 800 600 ``` -------------------------------- ### Get Window Names Source: https://github.com/snooz82/robotframework-browser-migration/blob/master/doc/index.html Returns and logs the names of all windows for the selected browser. ```APIDOC ## Get Window Names ### Description Returns and logs names of all windows of the selected browser. ### Parameters #### Query Parameters - **browser** (string) - Optional - Specifies the browser scope. Defaults to CURRENT. ``` -------------------------------- ### Get Browser IDs Example Source: https://github.com/snooz82/robotframework-browser-migration/blob/master/doc/index.html Returns the indices of all active browsers as a list. ```Robot Framework @{browser_ids} Get Browser Ids ``` -------------------------------- ### Get Window Titles Source: https://github.com/snooz82/robotframework-browser-migration/blob/master/doc/index.html Returns and logs titles of all windows of the selected browser. How to select the browser scope of this keyword, see Get Locations. ```APIDOC ## Get Window Titles ### Description Returns and logs titles of all windows of the selected browser. This keyword's browser scope can be configured using the 'Get Locations' keyword. ### Method N/A (Keyword) ### Endpoint N/A (Keyword) ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body N/A ### Request Example N/A ### Response #### Success Response (200) N/A #### Response Example N/A ``` -------------------------------- ### Initialize and Use Storage Module Source: https://github.com/snooz82/robotframework-browser-migration/blob/master/doc/index.html Initializes the storage module with a user prefix and provides functions to get and set data. It attempts to use localStorage if available, otherwise falls back to a plain object. ```javascript storage = function () { var prefix = 'robot-framework-'; var storage; function init(user) { if (user) prefix += user + '-'; storage = getStorage(); } function getStorage() { // Use localStorage if it's accessible, normal object otherwise. // Inspired by https://stackoverflow.com/questions/11214404 try { localStorage.setItem(prefix, prefix); localStorage.removeItem(prefix); return localStorage; } catch (exception) { return {}; } } function get(key, defaultValue) { var value = storage[fullKey(key)]; if (typeof value === 'undefined') return defaultValue; return value; } function set(key, value) { storage[fullKey(key)] = value; } function fullKey(key) { return prefix + key; } return {init: init, get: get, set: set, fullKey: fullKey}; }(); ``` -------------------------------- ### Enum Definition Example Source: https://github.com/snooz82/robotframework-browser-migration/blob/master/doc/index.html Illustrates how to define and use enumerations in Python, with examples of attribute access, value lookup, and name lookup. Enums can also be iterated over. ```python class Color(Enum): RED = 1 BLUE = 2 GREEN = 3 # Access by attribute print(Color.RED) # Access by value print(Color(1)) # Access by name print(Color['RED']) # Length and iteration print(len(Color)) print(list(Color)) ``` -------------------------------- ### Configure Multiple Chrome Options Source: https://github.com/snooz82/robotframework-browser-migration/blob/master/doc/index.html Example of configuring multiple Chrome options by separating method calls and attribute assignments with a semicolon. ```robotframework add_argument("--headless");add_argument("--start-maximized") ``` -------------------------------- ### Example Keyword Statistics Table Source: https://github.com/snooz82/robotframework-browser-migration/blob/master/Readme.md This table displays the analyzed usage of SeleniumLibrary keywords, including their call count, number of unique callers (parents), and migration status. ```text +------------------------------------------+-------+---------+------------------+ | Keyword | count | parents | migration status | +------------------------------------------+-------+---------+------------------+ | Add Cookie | 62 | 6 | | | Add Location Strategy | 6 | 2 | missing | | Alert Should Be Present | 19 | 15 | missing | | Assign Id To Element | 1 | 1 | | | Capture Page Screenshot | 24 | 17 | | | Checkbox Should Be Selected | 6 | 4 | | | Choose File | 4 | 4 | | | Click Element | 41 | 40 | | | Click Link | 45 | 40 | | | Close All Browsers | 22 | 22 | | | Close Browser | 11 | 8 | | | Close Window | 11 | 11 | | | Create Webdriver | 4 | 3 | missing | | Drag And Drop | 1 | 1 | | | Element Should Be Visible | 4 | 4 | | | Element Should Contain | 10 | 5 | | | Element Text Should Be | 38 | 20 | | | Execute Async Javascript | 18 | 11 | missing | | Execute Javascript | 13 | 11 | | | Get Browser Aliases | 2 | 1 | | | Get Element Attribute | 6 | 2 | | | Get Element Count | 7 | 6 | | | Get Element Size | 3 | 3 | | | Get Location | 2 | 2 | | | Get Text | 2 | 2 | | | Get Title | 1 | 1 | | | Get WebElement | 9 | 9 | | | Get WebElements | 4 | 4 | | | Get Window Size | 4 | 4 | | | Get Window Titles | 14 | 7 | | | Go Back | 1 | 1 | | | Go To | 370 | 41 | | ... | ... | ... | | ... | ... | ... | | ... | ... | ... | | | Wait Until Location Does Not Contain | 7 | 2 | | | Wait Until Location Is | 3 | 2 | | | Wait Until Location Is Not | 4 | 2 | | | Wait Until Page Contains | 17 | 17 | | | Wait Until Page Contains Element | 13 | 6 | | | Wait Until Page Does Not Contain | 2 | 2 | | | Wait Until Page Does Not Contain Element | 7 | 5 | | +------------------------------------------+-------+---------+------------------+ ``` -------------------------------- ### Get Source Source: https://github.com/snooz82/robotframework-browser-migration/blob/master/doc/index.html Returns the entire HTML source code of the current page or frame. ```APIDOC ## Get Source ### Description Returns the entire HTML source of the current page or frame. ### Response #### Success Response (200) - **html_source** (string) - The complete HTML source of the current page or frame. ``` -------------------------------- ### Get Locations Source: https://github.com/snooz82/robotframework-browser-migration/blob/master/doc/index.html Returns and logs the URLs of all windows for a specified browser. The browser can be identified by its index, alias, or a special keyword like 'CURRENT' or 'ALL'. ```APIDOC ## Get Locations ### Description Returns and logs URLs of all windows of the selected browser. ### Parameters * `browser` (str, optional) - The browser to get window information from. Can be an index or alias, 'CURRENT' (default), or 'ALL'. Defaults to 'CURRENT'. ### Returns * list - A list of URLs for the windows of the specified browser. ### Notes - `browser` argument specifies the browser scope. - 'CURRENT' selects the active browser. - 'ALL' selects all windows from all opened browsers. ``` -------------------------------- ### Get Window Size Source: https://github.com/snooz82/robotframework-browser-migration/blob/master/doc/index.html Returns the current window width and height as integers. Optionally returns inner window dimensions. ```APIDOC ## Get Window Size ### Description Returns current window width and height as integers. See also `Set Window Size`. If `inner` parameter is set to True, keyword returns HTML DOM window.innerWidth and window.innerHeight properties. ### Parameters #### Query Parameters - **inner** (boolean) - Optional - If True, returns inner window dimensions. Defaults to False. ### Request Example ```robotframework ${width} ${height}= Get Window Size ${width} ${height}= Get Window Size inner=True ``` ``` -------------------------------- ### Get Webelement Source: https://github.com/snooz82/robotframework-browser-migration/blob/master/doc/index.html Returns the first WebElement matching the given locator. See the Locating elements section for details about the locator syntax. ```APIDOC ## Get Webelement ### Description Returns the first WebElement matching the given locator. ### Method Not specified (likely a keyword in Robot Framework) ### Endpoint Not specified ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters - **locator** (WebElement) - Required - The locator for the element. ### Request Example ```robotframework ${webelement} = Get Webelement id=my-element ``` ### Response #### Success Response (200) - **webelement** (WebElement) - The first WebElement matching the locator. #### Response Example ```json "" ``` ``` -------------------------------- ### Set Selenium Timeout Example Source: https://github.com/snooz82/robotframework-browser-migration/blob/master/doc/index.html Sets the timeout for various keywords. The value can be a number (seconds) or a human-readable string. The previous value is returned. ```robotframework ${orig timeout} = Set Selenium Timeout 15 seconds Open page that loads slowly Set Selenium Timeout ${orig timeout} ``` -------------------------------- ### Set Selenium Speed Example Source: https://github.com/snooz82/robotframework-browser-migration/blob/master/doc/index.html Sets the delay after each Selenium command. The value can be a number (seconds) or a human-readable string. The previous value is returned. ```robotframework Set Selenium Speed 0.5 seconds ``` -------------------------------- ### Set Window Size Example Source: https://github.com/snooz82/robotframework-browser-migration/blob/master/doc/index.html Sets the current window size. Values can be numbers or strings. The 'inner' argument (new since SeleniumLibrary 4.0) adjusts for DOM innerWidth/innerHeight but does not support frames. ```robotframework Set Window Size 1024 768 ``` ```robotframework Set Window Size 1024 768 inner=True ``` -------------------------------- ### Capture Element Screenshot Example Source: https://github.com/snooz82/robotframework-browser-migration/blob/master/doc/index.html Captures a screenshot of an element and embeds it in the log file. The filename argument supports paths and patterns. Check browser driver documentation for element screenshot support. ```robotframework Capture Element Screenshot id:image_id Capture Element Screenshot id:image_id ${OUTPUTDIR}/id_image_id-1.png ``` -------------------------------- ### Get Theme Function Source: https://github.com/snooz82/robotframework-browser-migration/blob/master/doc/index.html Retrieves the current theme. It checks for a theme defined in libdoc, then checks the user's system preference for dark mode, and defaults to light mode. ```javascript function getTheme() { if (libdoc['theme']) { return libdoc['theme']; } else if (window.matchMedia('(prefers-color-scheme: dark)').matches) { return 'dark'; } else { return 'light;' } } ``` -------------------------------- ### Get Selenium Speed Source: https://github.com/snooz82/robotframework-browser-migration/blob/master/doc/index.html Retrieves the delay configured to be waited after each Selenium command. The value is returned as a human-readable string, for example, '1 second'. Further information is available in the 'Selenium Speed' section. ```APIDOC ## Get Selenium Speed ### Description Gets the delay that is waited after each Selenium command. ### Response #### Success Response (200) - **selenium_speed** (string) - The delay after each command in a human-readable format (e.g., '1 second'). ### See Also - Selenium Speed ``` -------------------------------- ### Open Browser with Alias Management Source: https://github.com/snooz82/robotframework-browser-migration/blob/master/doc/index.html Demonstrates how to manage browser aliases. New aliases open new browsers, while existing aliases switch to the corresponding browser. ```robotframework ${1_index} = Open Browser http://example.com Chrome alias=Chrome ``` ```robotframework ${2_index} = Open Browser http://example.com Firefox ``` ```robotframework ${3_index} = Open Browser http://example.com Chrome alias=Chrome ``` ```robotframework ${4_index} = Open Browser http://example.com Chrome alias=${1_index} ``` ```robotframework Should Be Equal ${1_index} ${3_index} ``` ```robotframework Should Be Equal ${1_index} ${4_index} ``` -------------------------------- ### Configure Library Import Order Source: https://github.com/snooz82/robotframework-browser-migration/blob/master/doc/index.html Import Browser library first and configure SeleniumLibraryToBrowser to prioritize it. This ensures that SeleniumLibraryToBrowser keywords are used when available in both libraries. ```robotframework *** Settings *** Library Browser Library SeleniumLibraryToBrowser prioritize_library=SeleniumLibraryToBrowser ``` -------------------------------- ### Import SeleniumLibraryToBrowser Source: https://context7.com/snooz82/robotframework-browser-migration/llms.txt Import SeleniumLibraryToBrowser in place of SeleniumLibrary. Constructor arguments mirror SeleniumLibrary's. Use 'prioritize_library' to resolve keyword conflicts when both libraries are loaded. ```robotframework *** Settings *** # Minimal standalone import – SeleniumLibraryToBrowser auto-imports Browser internally Library SeleniumLibraryToBrowser ``` ```robotframework # Full configuration with all arguments Library Browser # import Browser first Library SeleniumLibraryToBrowser ... timeout=5 seconds # default Wait Until ... timeout ... implicit_wait=10 seconds # Browser element-actionable timeout ... run_on_failure=Capture Page Screenshot # keyword run on any failure ... screenshot_root_directory=${OUTPUTDIR} # screenshot save location ... page_load_timeout=5 minutes # timeout for Go To / Reload ... prioritize_library=SeleniumLibraryToBrowser # resolve keyword conflicts ``` ```robotframework # Gradual migration: prioritize Browser keywords, prefix SL2B keywords with library name Library Browser Library SeleniumLibraryToBrowser prioritize_library=Browser ``` ```robotframework *** Test Cases *** Mixed Library Usage Open Browser https://example.com chrome # SeleniumLibraryToBrowser keyword Browser.Get Text h1 # explicit Browser keyword Get Text css=p # SeleniumLibraryToBrowser keyword ``` -------------------------------- ### Manage IE Page Setup via VBScript Source: https://github.com/snooz82/robotframework-browser-migration/blob/master/atest/resources/html/javascript/security_alert.html This VBScript code reads and temporarily clears Internet Explorer's header and footer settings from the registry. It then provides a function to restore the original settings. ```vbscript Dim WSHShell Dim myHeader Dim myFooter Set WSHShell = CreateObject("WScript.Shell") myHeader = WSHShell.RegRead("HKCU\Software\Microsoft\Internet Explorer\PageSetup\header") myFooter = WSHShell.RegRead("HKCU\Software\Microsoft\Internet Explorer\PageSetup\footer") WSHShell.RegWrite "HKCU\Software\Internet Explorer\PageSetup\header", "" WSHShell.RegWrite "HKCU\Software\Microsoft\Internet Explorer\PageSetup\footer", "" Sub ResetHeader() Dim WSHShell Set WSHShell = CreateObject("WScript.Shell") WSHShell.RegWrite "HKCU\Software\Microsoft\Internet Explorer\PageSetup\header", myHeader WSHShell.RegWrite "HKCU\Software\Microsoft\Internet Explorer\PageSetup\footer", myFooter End Sub ``` -------------------------------- ### Go To Source: https://github.com/snooz82/robotframework-browser-migration/blob/master/doc/index.html Navigates the current browser window to the provided URL. ```APIDOC ## Go To ### Description Navigates the current browser window to the provided URL. ### Method N/A (Keyword) ### Endpoint N/A (Keyword) ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body N/A ### Request Example N/A ### Response #### Success Response (200) N/A #### Response Example N/A ``` -------------------------------- ### Get Horizontal Position Source: https://github.com/snooz82/robotframework-browser-migration/blob/master/doc/index.html Returns the horizontal position of an element in pixels from the left side of the page. See also Get Vertical Position. ```robotframework Get Horizontal Position css:div#container ``` -------------------------------- ### Open Browser with CEF Options Source: https://github.com/snooz82/robotframework-browser-migration/blob/master/doc/index.html Illustrates launching Chromium Embedded Framework (CEF) applications. Use 'options' to set 'binary_location' and 'add_argument' for 'remote-debugging-port'. ```robotframework Open Browser options=webdriver.ChromeOptions() options.binary_location="/path/to/cef/application" options.add_argument("--remote-debugging-port=9222") ``` -------------------------------- ### Get Horizontal Position Source: https://github.com/snooz82/robotframework-browser-migration/blob/master/doc/index.html Determines the horizontal position of an element on the page relative to the left edge. The position is returned as an integer value in pixels. This can be used in conjunction with `Get Vertical Position` for precise element positioning checks. ```APIDOC ## Get Horizontal Position ### Description Returns the horizontal position of the element identified by `locator`. See the [Locating elements](https://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#locating-elements) section for details about the locator syntax. The position is returned in pixels off the left side of the page, as an integer. See also [Get Vertical Position](#Get%20Vertical%20Position). ### Method GET ### Endpoint /rest/api/element/{id}/position/x ### Parameters #### Path Parameters - **id** (string) - Required - The ID of the element. ### Request Example ``` GET /rest/api/element/element_id/position/x ``` ### Response #### Success Response (200) - **position** (integer) - The horizontal position in pixels from the left edge of the page. #### Response Example ```json { "position": 100 } ``` ``` -------------------------------- ### Get Table Cell Source: https://github.com/snooz82/robotframework-browser-migration/blob/master/doc/index.html Returns contents of a table cell. The table is located using the locator argument and its cell found using row and column. See the Locating elements section for details about the locator syntax. Both row and column indexes start from 1, and header and footer rows are included in the count. It is possible to refer to rows and columns from the end by using negative indexes so that -1 is the last row/column, -2 is the second last, and so on. All and elements anywhere in the table are considered to be cells. See Page Should Contain for an explanation about the loglevel argument. ```APIDOC ## Get Table Cell ### Description Returns contents of a table cell. ### Method Not specified (likely a keyword in Robot Framework) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters - **locator** (string) - Required - The locator for the table. - **row** (int) - Required - The row index of the cell. - **column** (int) - Required - The column index of the cell. - **loglevel** (string) - Optional - The log level for the operation. Defaults to 'TRACE'. ### Request Example ```robotframework ${cell_content} = Get Table Cell id=my-table row=2 column=3 ``` ### Response #### Success Response (200) - **text** (string) - The content of the table cell. #### Response Example ```json "Cell Data" ``` ``` -------------------------------- ### Open Browser with Chrome Options Source: https://github.com/snooz82/robotframework-browser-migration/blob/master/doc/index.html Demonstrates how to pass Chrome options to the 'Open Browser' keyword. Ensure backslashes in paths are properly escaped. For Windows paths, use four backslashes or Python raw strings. ```robotframework Open Browser Chrome options=webdriver.ChromeOptions() options.add_argument('--disable-dev-shm-usage') ``` -------------------------------- ### Demonstrate Prompt Box with JavaScript Source: https://github.com/snooz82/robotframework-browser-migration/blob/master/atest/resources/html/javascript/alert_prompt.html Use this JavaScript function to display a prompt box that asks the user for input. The input is then used to update the HTML content. ```javascript function myFunction() { var person = prompt("Please enter your name", "Harry Potter"); if (person != null) { document.getElementById("demo").innerHTML = "Hello " + person + "! How are you today?"; } } ``` -------------------------------- ### Get Vertical Position Source: https://github.com/snooz82/robotframework-browser-migration/blob/master/doc/index.html Returns the vertical position of the element identified by locator. See the Locating elements section for details about the locator syntax. The position is returned in pixels off the top of the page, as an integer. See also Get Horizontal Position. ```APIDOC ## Get Vertical Position ### Description Returns the vertical position of the element identified by the locator. ### Method Not specified (likely a keyword in Robot Framework) ### Endpoint Not specified ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters - **locator** (WebElement) - Required - The locator for the element. ### Request Example ```robotframework ${vertical_pos} = Get Vertical Position id=my-element ``` ### Response #### Success Response (200) - **position** (integer) - The vertical position of the element in pixels from the top of the page. #### Response Example ```json 150 ``` ``` -------------------------------- ### Get Title Source: https://github.com/snooz82/robotframework-browser-migration/blob/master/doc/index.html Returns the title of the current page. ```APIDOC ## Get Title ### Description Returns the title of the current page. ### Method Not specified (likely a keyword in Robot Framework) ### Endpoint Not specified ### Parameters None ### Request Example ```robotframework ${page_title} = Get Title ``` ### Response #### Success Response (200) - **title** (string) - The title of the current page. #### Response Example ```json "Page Title" ``` ``` -------------------------------- ### Open Browser with Python Options Instance Source: https://github.com/snooz82/robotframework-browser-migration/blob/master/doc/index.html Shows how to use a Python class instance for browser options. The SeleniumLibrary will use the instance directly without conversion. ```python options = webdriver.ChromeOptions() options.add_argument('--disable-dev-shm-usage') return options ``` -------------------------------- ### Get Location Source: https://github.com/snooz82/robotframework-browser-migration/blob/master/doc/index.html Returns the current URL of the browser window. ```APIDOC ## Get Location ### Description Returns the current browser window URL. ### Method GET ### Endpoint /session/{sessionId}/url ### Parameters None ### Returns * string - The current URL of the browser window. ``` -------------------------------- ### Get Cookie Source: https://github.com/snooz82/robotframework-browser-migration/blob/master/doc/index.html Returns information of a cookie with a specified name. ```APIDOC ## Get Cookie ### Description Returns information of cookie with `name` as an object. If no cookie is found with `name`, keyword fails. The cookie object contains details about the cookie. Attributes available in the object are documented below. ### Method Not Applicable (Keyword) ### Endpoint Not Applicable (Keyword) ### Parameters #### Path Parameters - **name** (str) - Required - The name of the cookie to retrieve. ### Request Example ```robotframework ${cookie} = Get Cookie foo ``` ### Response #### Success Response - **CookieInformation** (object) - An object containing cookie details. Attributes include: - **name** (str) - The name of the cookie. - **value** (str) - Value of the cookie. - **path** (str) - Indicates a URL path. - **domain** (str) - The domain the cookie is visible to. - **secure** (bool) - True if the cookie is only used with HTTPS connections. - **httpOnly** (bool) - True if the cookie is not accessible via JavaScript. - **expiry** (datetime) - Python datetime object indicating when the cookie expires. - **extra** (dict) - Possible attributes outside of the WebDriver specification. #### Response Example ```robotframework ${cookie} = Get Cookie foo Should Be Equal ${cookie.name} foo Should Be Equal ${cookie.value} bar Should Be True ${cookie.expiry.year} > 2017 ``` ``` -------------------------------- ### Switch Window Using Locator Strategies Source: https://github.com/snooz82/robotframework-browser-migration/blob/master/doc/index.html Switches to a browser window based on various locator strategies like title, URL, or handle. Supports NEW, MAIN, CURRENT, and custom strategies. ```robotframework Click Link popup1 Switch Window example Title Should Be Pop-up 1 Click Button popup2 ${handle} = Switch Window NEW Title Should Be Pop-up 2 Switch Window ${handle} ``` -------------------------------- ### Document Ready Initialization with jQuery Source: https://github.com/snooz82/robotframework-browser-migration/blob/master/doc/index.html This snippet uses jQuery's document ready function to parse templates, set the document title, initialize storage, set the theme, and render various sections of the documentation. It also handles tag searching and keyword statistics. ```javascript $(document).ready(function() { parseTemplates(); document.title = libdoc.name; storage.init('libdoc'); setTheme(); renderTemplate('base', libdoc, $('body')); if (libdoc.inits.length) { libdoc.typedocs.map(function(type) { var index = type.usages.indexOf('\ '__init__\ ''); if (index != -1) type.usages[index] = 'Importing'; }); renderTemplate('importing', libdoc); } renderTemplate('shortcuts', libdoc); renderTemplate('keyword-shortcuts', libdoc); renderTemplate('keywords', libdoc); renderTemplate('data-types', libdoc); renderTemplate('footer', libdoc); const params = util.parseQueryString(window.location.search.slice(1)); let selectedTag = ""; if ("tag" in params) { selectedTag = params["tag"]; tagSearch(selectedTag, window.location.hash); } if (libdoc.tags.length) { libdoc.selectedTag = selectedTag; renderTemplate('tags-shortcuts', libdoc); } scrollToHash(); setTimeout(function() { document.getElementById("keyword-statistics-header").innerText = '' + libdoc.keywords.length; if (storage.get('keyword-wall') === 'open') { openKeywordWall(); } }, 0); createModal(); }); ``` -------------------------------- ### Get Browser Ids Source: https://github.com/snooz82/robotframework-browser-migration/blob/master/doc/index.html Returns a list of all active browser IDs. ```APIDOC ## Get Browser Ids ### Description Returns a list of all active browser IDs. ### Method Not Applicable (Keyword) ### Endpoint Not Applicable (Keyword) ### Parameters None ### Request Example None ### Response #### Success Response - **browser_ids** (list) - A list of strings, where each string is a browser ID. ``` -------------------------------- ### Get Browser Ids Source: https://github.com/snooz82/robotframework-browser-migration/blob/master/doc/index.html Returns the indices of all active browsers as a list. ```APIDOC ## Get Browser Ids ### Description Returns index of all active browser as list. ### Method Not specified (likely a keyword invocation in Robot Framework) ### Endpoint Not applicable (keyword-based) ### Parameters None ### Request Example ```robotframework @{browser_indices} = Get Browser Ids ``` ### Response #### Success Response - **list** (list of int) - A list of active browser indices. #### Response Example ```json [1, 2, 3] ``` ``` -------------------------------- ### Open Browser Keyword Source: https://context7.com/snooz82/robotframework-browser-migration/llms.txt Opens a new browser context and navigates to a URL. Supports major browsers and returns an index for switching. Use named aliases for easier session management. ```robotframework *** Settings *** Library SeleniumLibraryToBrowser implicit_wait=10 seconds run_on_failure=Nothing *** Test Cases *** Open And Navigate # Positional: url, browser ${index} = Open Browser https://example.com chrome Title Should Be Example Domain # Named alias for later switching Open Browser https://example.com firefox alias=ff_session Switch Browser ff_session # Headless chrome Open Browser https://example.com headlesschrome # Supported browser values: chrome, firefox, ff, headlessfirefox, # chromium, googlechrome, gc, headlesschrome, edge, webkit, safari Close All Browsers ``` -------------------------------- ### Get Browser Aliases Source: https://github.com/snooz82/robotframework-browser-migration/blob/master/doc/index.html Returns aliases of all active browsers as a NormalizedDict. ```APIDOC ## Get Browser Aliases ### Description Returns aliases of all active browser that has an alias as NormalizedDict. The dictionary contains the aliases as keys and the index as value. This can be accessed as dictionary `${aliases.key}` or as list `@{aliases}[0]`. See [Switch Browser](link-to-switch-browser) for more information and examples. New in SeleniumLibrary 4.0 ### Method Not specified (likely a keyword invocation in Robot Framework) ### Endpoint Not applicable (keyword-based) ### Parameters None ### Request Example ```robotframework &{aliases} = Get Browser Aliases Log ${aliases.BrowserA} FOR ${alias} IN @{aliases} Log ${alias} END ``` ### Response #### Success Response - **aliases** (NormalizedDict) - A dictionary containing browser aliases as keys and their indices as values. #### Response Example ```json { BrowserA=1|BrowserB=2 } ``` ``` -------------------------------- ### Open Browser Source: https://github.com/snooz82/robotframework-browser-migration/blob/master/doc/index.html Opens a new browser instance to the optional URL. Supports various browsers and configurations. ```APIDOC ## Open Browser ### Description Opens a new browser instance to the optional `url`. The `browser` argument specifies which browser to use. Supported browsers include Firefox, Google Chrome, Headless Firefox, Headless Chrome, Internet Explorer, Edge, and Safari. A matching Selenium browser driver must be available. ### Method Not applicable (Keyword-driven) ### Endpoint Not applicable (Keyword-driven) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters - **url** (str | None) - Optional - The URL to navigate to after opening the browser. - **browser** (str) - Optional - The browser to use (e.g., 'chrome', 'firefox'). Defaults to 'chrome'. - **alias** (str | None) - Optional - An alias for the browser instance, used for switching between browsers. - **remote_url** (bool | str) - Optional - Specifies if the URL is remote. Defaults to False. - **desired_capabilities** (dict | None | str) - Optional - Desired capabilities for the browser. - **ff_profile_dir** (str | None) - Optional - Path to the Firefox profile directory. - **options** (Any) - Optional - Browser-specific options. - **service_log_path** (str | None) - Optional - Path for the service log. - **executable_path** (str | None) - Optional - Path to the browser executable. ### Request Example ```robotframework Open Browser https://www.example.com chrome alias=MyBrowser ``` ### Response #### Success Response (200) None (This is a keyword that performs an action) #### Response Example None ``` -------------------------------- ### Open Browser with Chrome Options Source: https://github.com/snooz82/robotframework-browser-migration/blob/master/doc/index.html Opens a new browser instance with specified Chrome options. Supports various configurations like disabling pop-up blocking, ignoring certificate errors, and setting a remote debugging port. Ensure correct path escaping for Windows OS. ```robotframework Open Browser hhttp://example.com Chrome options=add_argument("--disable-popup-blocking"); add_argument("--ignore-certificate-errors") ``` ```robotframework ${options} = Get Options # Selenium options instance. ``` ```robotframework Open Browser hhttp://example.com Chrome options=${options} ``` ```robotframework Open Browser None Chrome options=binary_location="/path/to/binary";add_argument("remote-debugging-port=port") # Start Chomium-based application. ``` ```robotframework Open Browser None Chrome options=binary_location=r"C:\\path\\to\\binary" # Windows OS path escaping. ``` -------------------------------- ### Get Current Browser URL Source: https://github.com/snooz82/robotframework-browser-migration/blob/master/doc/index.html Returns the current URL of the browser window. ```robotframework Get Location ``` -------------------------------- ### Import SeleniumLibraryToBrowser for Dry-Run Source: https://context7.com/snooz82/robotframework-browser-migration/llms.txt In dry-run mode, SeleniumLibraryToBrowser only exposes implemented keywords. Unimplemented keywords will fail the dry run. ```robotframework Library SeleniumLibraryToBrowser ``` -------------------------------- ### Get Cookies Source: https://github.com/snooz82/robotframework-browser-migration/blob/master/doc/index.html Returns all cookies of the current page, either as a string or a dictionary. ```APIDOC ## Get Cookies ### Description Returns all cookies of the current page. If `as_dict` argument evaluates as false, cookie information is returned as a single string in format `name1=value1; name2=value2; name3=value3`. When `as_dict` argument evaluates as true, cookie information is returned as Robot Framework dictionary format. ### Method Not Applicable (Keyword) ### Endpoint Not Applicable (Keyword) ### Parameters #### Query Parameters - **as_dict** (bool) - Optional - If true, returns cookies as a dictionary. Defaults to False. ### Request Example ```robotframework ${cookies_string} = Get Cookies ${cookies_dict} = Get Cookies as_dict=True ``` ### Response #### Success Response - **cookies** (str or dict) - All cookies of the current page. Format depends on the `as_dict` parameter. ``` -------------------------------- ### Open Browser with Executable Path Source: https://github.com/snooz82/robotframework-browser-migration/blob/master/doc/index.html Specifies the path to the browser driver executable. If not provided, the driver is assumed to be in the system's PATH. ```robotframework Open Browser Chrome executable_path=/path/to/chromedriver ``` -------------------------------- ### Get Window Identifiers Source: https://github.com/snooz82/robotframework-browser-migration/blob/master/doc/index.html Returns and logs the id attributes of all windows for the selected browser. ```APIDOC ## Get Window Identifiers ### Description Returns and logs id attributes of all windows of the selected browser. ### Parameters #### Query Parameters - **browser** (string) - Optional - Specifies the browser scope. Defaults to CURRENT. ``` -------------------------------- ### Run SeleniumStats Tool Source: https://github.com/snooz82/robotframework-browser-migration/blob/master/Readme.md Execute the SeleniumStats tool with the path to your output.xml file. This file can be generated from a regular run or a dryrun. ```bash SeleniumStats c:/MyTests/output.xml ``` -------------------------------- ### Analyze SeleniumLibrary Usage with SeleniumStats CLI Source: https://context7.com/snooz82/robotframework-browser-migration/llms.txt Use the SeleniumStats CLI tool to analyze Robot Framework's `output.xml` for keyword usage counts and migration readiness. This helps identify keywords that need to be migrated to the Browser library. ```bash # Run tests first to produce an output.xml (or use --dryrun for zero-execution analysis) robot --dryrun --outputdir /tmp/results tests/ # Analyse the output.xml SeleniumStats /tmp/results/output.xml # Or invoke as a Python module python -m SeleniumStats /tmp/results/output.xml ``` -------------------------------- ### Get Window Titles Source: https://github.com/snooz82/robotframework-browser-migration/blob/master/doc/index.html Retrieves a list of window titles for a given browser ID. ```APIDOC ## Get Window Titles ### Description Retrieves a list of window titles for a given browser ID. ### Method Not Applicable (Keyword) ### Endpoint Not Applicable (Keyword) ### Parameters #### Path Parameters - **browser** (str) - Required - The ID of the browser for which to get window titles. ### Request Example None ### Response #### Success Response - **window_titles** (list) - A list of strings, where each string is a window title. ``` -------------------------------- ### Get All Links Source: https://github.com/snooz82/robotframework-browser-migration/blob/master/doc/index.html Returns a list containing the IDs of all links found on the current page. ```APIDOC ## Get All Links ### Description Returns a list containing ids of all links found in current page. If a link has no id, an empty string will be in the list instead. ### Method Not specified (likely a keyword invocation in Robot Framework) ### Endpoint Not applicable (keyword-based) ### Parameters None ### Request Example ```robotframework @{link_ids} = Get All Links ``` ### Response #### Success Response - **list** (list of str) - A list of link IDs found on the page. #### Response Example ```json ["link1", "", "link3"] ``` ``` -------------------------------- ### Get Window Position Source: https://github.com/snooz82/robotframework-browser-migration/blob/master/doc/index.html Returns the current window position relative to the top-left corner of the screen. ```APIDOC ## Get Window Position ### Description Returns current window position. The position is relative to the top left corner of the screen. Returned values are integers. See also `Set Window Position`. ### Request Example ```robotframework ${x} ${y}= Get Window Position ``` ``` -------------------------------- ### Get Element Size Source: https://github.com/snooz82/robotframework-browser-migration/blob/master/doc/index.html Returns the width and height of an element in pixels. The element is identified by a locator. ```robotframework `${width}` `${height} =` `Get Element Size` `css:div#container` ``` -------------------------------- ### Go Back Source: https://github.com/snooz82/robotframework-browser-migration/blob/master/doc/index.html Simulates the user clicking the back button on their browser. ```APIDOC ## Go Back ### Description Simulates the user clicking the back button on their browser. ### Method N/A (Keyword) ### Endpoint N/A (Keyword) ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body N/A ### Request Example N/A ### Response #### Success Response (200) N/A #### Response Example N/A ``` -------------------------------- ### Navigation Keywords: Go To, Go Back, Reload Page Source: https://context7.com/snooz82/robotframework-browser-migration/llms.txt Navigate to URLs, go back in history, or reload the current page. 'Go To' respects the 'page_load_timeout' configured during library import. ```robotframework *** Test Cases *** Navigation Keywords Open Browser https://example.com chrome Go To https://example.com/page1 Location Should Be https://example.com/page1 Go To https://example.com/page2 Go Back Location Should Contain page1 Reload Page Title Should Be Page 1 Title [Teardown] Close All Browsers ``` -------------------------------- ### Registering custom pseudo-classes Source: https://github.com/snooz82/robotframework-browser-migration/blob/master/doc/index.html This code demonstrates how custom pseudo-classes like ':radio', ':checkbox', ':file', ':password', and ':image' are registered within the library's selector engine. ```javascript b.pseudos[e]=de(e);for(e in{submit:!0,reset:!0})b.pseudos[e]=he(e) ``` -------------------------------- ### Switch to Browser Library Keywords Source: https://github.com/snooz82/robotframework-browser-migration/blob/master/doc/index.html Once all conflicting keywords are replaced with Browser library equivalents, change the prioritize_library argument to Browser. This ensures Browser library keywords are used. ```robotframework Library SeleniumLibraryToBrowser prioritize_library=Browser ``` -------------------------------- ### Get Element Count Source: https://github.com/snooz82/robotframework-browser-migration/blob/master/doc/index.html Returns the total number of elements that match the given locator. This keyword is new in SeleniumLibrary 3.0. ```robotframework `${count} =` `Get Element Count` `name:div_name` `Should Be True` `${count} > 2` ``` -------------------------------- ### Get Window Handles Source: https://github.com/snooz82/robotframework-browser-migration/blob/master/doc/index.html Returns all child window handles of the selected browser as a list. Can be used to exclude windows with 'Select Window'. ```APIDOC ## Get Window Handles ### Description Returns all child window handles of the selected browser as a list. Can be used as a list of windows to exclude with `Select Window`. ### Parameters #### Query Parameters - **browser** (string) - Optional - Specifies the browser scope. Defaults to CURRENT. ``` -------------------------------- ### Open Browser with Service Log Path Source: https://github.com/snooz82/robotframework-browser-migration/blob/master/doc/index.html Configures the path for browser driver logs. The '{index}' marker in the path will be replaced with a unique running index. ```robotframework Open Browser Chrome service_log_path=./driver.log ``` ```robotframework Open Browser Chrome service_log_path=./driver-{index}.log ``` -------------------------------- ### Get Webelements Source: https://github.com/snooz82/robotframework-browser-migration/blob/master/doc/index.html Returns a list of WebElements matching the given locator. See the Locating elements section for details about the locator syntax. ```APIDOC ## Get Webelements ### Description Returns a list of WebElements matching the given locator. ### Method Not specified (likely a keyword in Robot Framework) ### Endpoint Not specified ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters - **locator** (WebElement) - Required - The locator for the elements. ### Request Example ```robotframework ${webelements} = Get Webelements class=my-elements ``` ### Response #### Success Response (200) - **webelements** (list) - A list of WebElements matching the locator. #### Response Example ```json ["", ""] ``` ``` -------------------------------- ### Navigate to URL with Browser Library Source: https://github.com/snooz82/robotframework-browser-migration/blob/master/doc/index.html Navigates the current browser window to the provided URL. This is a fundamental navigation keyword. ```robotframework *** Keywords *** Go To [Arguments] ${url} [Documentation] Navigates the current browser window to the provided ${url}. # Implementation would go here, likely calling a Browser library keyword ``` -------------------------------- ### Add Argument to Chrome Options Source: https://github.com/snooz82/robotframework-browser-migration/blob/master/doc/index.html Demonstrates how to add an argument to Chrome options using the string format. Ensure correct quoting for string arguments. ```robotframework add_argument("--headless") ``` -------------------------------- ### Get Value Source: https://github.com/snooz82/robotframework-browser-migration/blob/master/doc/index.html Returns the value attribute of the element identified by locator. See the Locating elements section for details about the locator syntax. ```APIDOC ## Get Value ### Description Returns the value attribute of the element identified by the locator. ### Method Not specified (likely a keyword in Robot Framework) ### Endpoint Not specified ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters - **locator** (WebElement) - Required - The locator for the element. ### Request Example ```robotframework ${input_value} = Get Value id=my-input ``` ### Response #### Success Response (200) - **value** (string) - The value attribute of the element. #### Response Example ```json "Input Value" ``` ``` -------------------------------- ### Get Text Source: https://github.com/snooz82/robotframework-browser-migration/blob/master/doc/index.html Returns the text value of the element identified by locator. See the Locating elements section for details about the locator syntax. ```APIDOC ## Get Text ### Description Returns the text value of the element identified by the locator. ### Method Not specified (likely a keyword in Robot Framework) ### Endpoint Not specified ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters - **locator** (WebElement) - Required - The locator for the element. ### Request Example ```robotframework ${element_text} = Get Text id=my-element ``` ### Response #### Success Response (200) - **text** (string) - The text content of the element. #### Response Example ```json "Element Text Content" ``` ``` -------------------------------- ### Add Experimental Option to Chrome Source: https://github.com/snooz82/robotframework-browser-migration/blob/master/doc/index.html Shows how to add an experimental option to Chrome options. The key and value are provided as strings. ```robotframework add_experimental_option("key", "value") ``` -------------------------------- ### Test Case with Implemented and Unimplemented Keywords Source: https://context7.com/snooz82/robotframework-browser-migration/llms.txt This test case demonstrates keywords that are implemented and not implemented in dry-run mode. Unimplemented keywords will cause the dry run to fail. ```robotframework Check Migration Readiness Open Browser https://example.com chrome # IMPLEMENTED – passes dry run Handle Alert # NOT IMPLEMENTED – fails dry run Execute Async Javascript return 1 # NOT IMPLEMENTED – fails dry run Create Webdriver Chrome # NOT IMPLEMENTED – fails dry run ``` -------------------------------- ### Table Cell Should Contain Source: https://github.com/snooz82/robotframework-browser-migration/blob/master/doc/index.html Verifies that a specific table cell contains the expected text. This keyword internally uses 'Get Table Cell'. ```APIDOC ## Table Cell Should Contain ### Description Verifies table cell contains text `expected`. See `Get Table Cell` that this keyword uses internally for an explanation about accepted arguments. ### Parameters #### Path Parameters - **locator** (WebElement) - Required - The table element. - **row** (integer) - Required - The row number of the cell (1-based). - **column** (integer) - Required - The column number of the cell (1-based). - **expected** (string) - Required - The expected text content of the cell. - **loglevel** (string) - Optional - Logging level. Default is TRACE. ```