browserrobotframeworkplaywrightbrowserstack

Robot framework Browser library with BrowserStack


Is it possible to use BrowserStack when using Browser library in RobotFramework

There is an article on how to do it with SeleniumLibrary ( https://medium.com/detesters/integrating-robot-framework-with-browserstock-bddf5b0e0c14 )

and also an article on how to do it with Playwright directly (see this page )

But can it be done with Browser library, and if yes, how is that done?


Solution

  • With the following init.robot file:

    *** Settings ***
    Force Tags       test
    Documentation    Test Suite
    Suite Setup      Setup Browserstack
    Resource         ../Variables/variables.robot
    Library          Browser
    
    *** Variables ***
    &{desiredCapabilities}      os=Windows
    ...                         os_version=10
    ...                         browser=chrome
    ...                         name=TestInit
    ...                         browserstack.username=${BROWSERSTACK_USERNAME}
    ...                         browserstack.accessKey=${BROWSERSTACK_ACCESSKEY}
    ...                         client.playwrightVersion=1.17.2
    
    *** Keywords ***
    Setup Browserstack
        ${BSENCODEDCAPS}            Evaluate    urllib.parse.quote( json.dumps(${desiredCapabilities}) )
        Connect To Browser          wss://cdp.browserstack.com/playwright?caps=${BSENCODEDCAPS}
    

    It took some time, but with the help of a great colleague I was able to get this.