Failing to Login with authentication using Browser Library

Hi,

I have previously used the SeleniumLibrary and successfully automated more than 150 test cases for a 3rd party product with this library. Since the Browser Library is said to have better handling of waits I wanted to try this but I cannot get the login to work.

RF with SeleniumLibrary:

Login to 3DX

Login to 3DX and wait for the object count to appear.

Set Selenium Timeout ${SELENIUM TIMEOUT}
IF ‘${HEADLESS}’ == ‘yes’
Open Browser ${LOGIN URL} ${BROWSER} options=${HEADLESS OPTIONS}
ELSE
Open Browser ${LOGIN URL} ${BROWSER}
END
Set Window Size 1920 1080
${width} ${height}= Get Window Size
Log Height: ${height}
Log Width: ${width}
Set Selenium Speed ${DELAY}
Title Should Be Login | 3DEXPERIENCE ID | Dassault Systèmes
Wait Until Element Is Visible xpath://[@id*=“username”]
Input Text xpath://[@id=“username”] ${USERNAME}
Input Text xpath://
[@id=“password”] ${PASSWORD}
Click Element xpath://input[@type=‘submit’]
Wait Until Page Contains Element content
Select Frame content
Wait Until Element Is Visible xpath://*[@id=“mx_objectCount”]

RF with Browser:

Login to 3DX

Login to 3DX and wait for the object count to appear.

IF ‘${HEADLESS}’ == ‘yes’
New Browser browser=${BROWSER} headless=True args=${HEADLESS OPTIONS}
ELSE
New Browser browser=${BROWSER} headless=False
END
New Page ${LOGIN URL}
Set Browser Timeout ${BROWSER TIMEOUT}
Set Viewport Size width=1920 height=1080
${size} Get Viewport Size key=ALL
Get Title contains Login | 3DEXPERIENCE ID | Dassault Systèmes
Get Element xpath=//[@id*=“username”]
Fill Text xpath=//[@id=“username”] ${USERNAME}
Fill Text xpath=//
[@id=“password”] ${PASSWORD}
Take Screenshot
${url} Get Url
Click xpath=//input[@type=‘submit’]
Take Screenshot
${url} Get Url
Take Screenshot
Get Element id=content >>> xpath=//*[@id=“mx_objectCount”]
Set Selector Prefix content scope=Test
Get Element xpath=//*[@id=“mx_objectCount”]

The problem is that after supplying the user & password and clicking on submit, the login gets stuck. In the transition from the login page and the submission of user credentials, to the landing page, the java server is requiring or requesting for something which RF/Playwright isn’t supplying I guess.

I retrieved the url before and after clicking on submit.

Before: https://3dpassport-uat01.plm.ericsson.net/3dpassport/login?service=https%3A%2F%2F3dspace-uat01.plm.ericsson.net%2F3dspace%2F%3FserverId%3Dplmuat01_MCS_Front_5
After: https://3dspace-uat01.plm.ericsson.net/3dspace/common/emxSecurityContextSelection.jsp

So the login works with Selenium but not with Playwright. Does anybody have an idea why it doesn’t work?

I’m pasting in the Playwright log below.

{“level”:30,“time”:“2026-05-29T05:34:39.471Z”,“pid”:2362321,“hostname”:“ESEPAPLDAP016.pcop.ericsson.se”,“msg”:“Listening on 127.0.0.1:49537”}
{“level”:30,“time”:“2026-05-29T05:34:39.496Z”,“pid”:2362321,“hostname”:“ESEPAPLDAP016.pcop.ericsson.se”,“msg”:“Start of node method newBrowser”}
{“level”:30,“time”:“2026-05-29T05:34:39.569Z”,“pid”:2362321,“hostname”:“ESEPAPLDAP016.pcop.ericsson.se”,“msg”:“Adding browser to stack: chromium, version: 141.0.7390.37”}
{“level”:30,“time”:“2026-05-29T05:34:39.569Z”,“pid”:2362321,“hostname”:“ESEPAPLDAP016.pcop.ericsson.se”,“msg”:“Adding 0 contexts to browser”}
{“level”:30,“time”:“2026-05-29T05:34:39.569Z”,“pid”:2362321,“hostname”:“ESEPAPLDAP016.pcop.ericsson.se”,“msg”:“End of node method newBrowser”}
{“level”:30,“time”:“2026-05-29T05:34:39.574Z”,“pid”:2362321,“hostname”:“ESEPAPLDAP016.pcop.ericsson.se”,“msg”:“Start of node method newPage”}
{“level”:30,“time”:“2026-05-29T05:34:39.574Z”,“pid”:2362321,“hostname”:“ESEPAPLDAP016.pcop.ericsson.se”,“msg”:“currentBrowser: {“name”:“chromium”,“browser”:{”_type":“Browser”,“_guid”:“browser@2383be7b844d1f6806b8461502063c7f”},“headless”:true,“_contextStack”:,“id”:“browser=890084dc-bdcc-4b48-a6bb-c9708dc92820”}"}
{“level”:30,“time”:“2026-05-29T05:34:39.580Z”,“pid”:2362321,“hostname”:“ESEPAPLDAP016.pcop.ericsson.se”,“msg”:“Setting default timeout for context context=85ceee94-d47c-4ae8-9bff-3fc5b8d1ac6e to 10000”}
{“level”:30,“time”:“2026-05-29T05:34:39.580Z”,“pid”:2362321,“hostname”:“ESEPAPLDAP016.pcop.ericsson.se”,“msg”:“Changed active context: context=85ceee94-d47c-4ae8-9bff-3fc5b8d1ac6e”}
{“level”:30,“time”:“2026-05-29T05:34:39.604Z”,“pid”:2362321,“hostname”:“ESEPAPLDAP016.pcop.ericsson.se”,“msg”:“Video path: undefined”}
{“level”:30,“time”:“2026-05-29T05:34:39.604Z”,“pid”:2362321,“hostname”:“ESEPAPLDAP016.pcop.ericsson.se”,“msg”:“Changed active page”}
{“level”:30,“time”:“2026-05-29T05:34:39.790Z”,“pid”:2362321,“hostname”:“ESEPAPLDAP016.pcop.ericsson.se”,“msg”:“End of node method newPage”}
{“level”:30,“time”:“2026-05-29T05:34:39.796Z”,“pid”:2362321,“hostname”:“ESEPAPLDAP016.pcop.ericsson.se”,“msg”:“Start of node method setViewportSize”}
{“level”:30,“time”:“2026-05-29T05:34:39.798Z”,“pid”:2362321,“hostname”:“ESEPAPLDAP016.pcop.ericsson.se”,“msg”:“End of node method setViewportSize”}
{“level”:30,“time”:“2026-05-29T05:34:39.810Z”,“pid”:2362321,“hostname”:“ESEPAPLDAP016.pcop.ericsson.se”,“msg”:“Start of node method getElement”}
{“level”:30,“time”:“2026-05-29T05:34:39.810Z”,“pid”:2362321,“hostname”:“ESEPAPLDAP016.pcop.ericsson.se”,“msg”:“Strict mode is enabled, find Locator with xpath=//[@id*=“username”] in page.”}
{“level”:30,“time”:“2026-05-29T05:34:39.948Z”,“pid”:2362321,“hostname”:“ESEPAPLDAP016.pcop.ericsson.se”,“msg”:“End of node method getElement”}
{“level”:30,“time”:“2026-05-29T05:34:39.951Z”,“pid”:2362321,“hostname”:“ESEPAPLDAP016.pcop.ericsson.se”,“msg”:“Start of node method fillText”}
{“level”:30,“time”:“2026-05-29T05:34:39.951Z”,“pid”:2362321,“hostname”:“ESEPAPLDAP016.pcop.ericsson.se”,“msg”:“Strict mode is enabled, find Locator with xpath=//[@id=“username”] in page."}
{“level”:30,“time”:“2026-05-29T05:34:39.957Z”,“pid”:2362321,“hostname”:“ESEPAPLDAP016.pcop.ericsson.se”,“msg”:“End of node method fillText”}
{“level”:30,“time”:“2026-05-29T05:34:39.962Z”,“pid”:2362321,“hostname”:“ESEPAPLDAP016.pcop.ericsson.se”,“msg”:“Start of node method fillText”}
{“level”:30,“time”:“2026-05-29T05:34:39.962Z”,“pid”:2362321,“hostname”:“ESEPAPLDAP016.pcop.ericsson.se”,“msg”:"Strict mode is enabled, find Locator with xpath=//
[@id=“password”] in page.”}
{“level”:30,“time”:“2026-05-29T05:34:39.967Z”,“pid”:2362321,“hostname”:“ESEPAPLDAP016.pcop.ericsson.se”,“msg”:“End of node method fillText”}
{“level”:30,“time”:“2026-05-29T05:34:39.971Z”,“pid”:2362321,“hostname”:“ESEPAPLDAP016.pcop.ericsson.se”,“msg”:“Start of node method takeScreenshot”}
{“level”:30,“time”:“2026-05-29T05:34:39.971Z”,“pid”:2362321,“hostname”:“ESEPAPLDAP016.pcop.ericsson.se”,“Take screenshot with options: “:{“path”:”/opt/plm/plmdev06/RobotFW_bl/logs_20260529_073438_UAT/browser/screenshot/robotframework-browser-screenshot-1.png”,“fileType”:“png”,“fullPage”:false,“timeout”:90000,“omitBackground”:false}}
{“level”:30,“time”:“2026-05-29T05:34:40.240Z”,“pid”:2362321,“hostname”:“ESEPAPLDAP016.pcop.ericsson.se”,“msg”:“End of node method takeScreenshot”}
{“level”:30,“time”:“2026-05-29T05:34:40.245Z”,“pid”:2362321,“hostname”:“ESEPAPLDAP016.pcop.ericsson.se”,“msg”:“Start of node method click”}
{“level”:30,“time”:“2026-05-29T05:34:40.245Z”,“pid”:2362321,“hostname”:“ESEPAPLDAP016.pcop.ericsson.se”,“msg”:“Strict mode is enabled, find Locator with xpath=//input[@type=‘submit’] in page.”}
{“level”:30,“time”:“2026-05-29T05:34:40.551Z”,“pid”:2362321,“hostname”:“ESEPAPLDAP016.pcop.ericsson.se”,“msg”:“End of node method click”}
{“level”:30,“time”:“2026-05-29T05:34:40.555Z”,“pid”:2362321,“hostname”:“ESEPAPLDAP016.pcop.ericsson.se”,“msg”:“Start of node method takeScreenshot”}
{“level”:30,“time”:“2026-05-29T05:34:40.555Z”,“pid”:2362321,“hostname”:“ESEPAPLDAP016.pcop.ericsson.se”,“Take screenshot with options: “:{“path”:”/opt/plm/plmdev06/RobotFW_bl/logs_20260529_073438_UAT/browser/screenshot/robotframework-browser-screenshot-2.png”,“fileType”:“png”,“fullPage”:false,“timeout”:90000,“omitBackground”:false}}
{“level”:30,“time”:“2026-05-29T05:34:41.228Z”,“pid”:2362321,“hostname”:“ESEPAPLDAP016.pcop.ericsson.se”,“msg”:“End of node method takeScreenshot”}
{“level”:30,“time”:“2026-05-29T05:34:41.235Z”,“pid”:2362321,“hostname”:“ESEPAPLDAP016.pcop.ericsson.se”,“msg”:“Start of node method takeScreenshot”}
{“level”:30,“time”:“2026-05-29T05:34:41.235Z”,“pid”:2362321,“hostname”:“ESEPAPLDAP016.pcop.ericsson.se”,“Take screenshot with options: “:{“path”:”/opt/plm/plmdev06/RobotFW_bl/logs_20260529_073438_UAT/browser/screenshot/robotframework-browser-screenshot-3.png”,“fileType”:“png”,“fullPage”:false,“timeout”:90000,“omitBackground”:false}}
{“level”:30,“time”:“2026-05-29T05:34:41.788Z”,“pid”:2362321,“hostname”:“ESEPAPLDAP016.pcop.ericsson.se”,“msg”:“End of node method takeScreenshot”}
{“level”:30,“time”:“2026-05-29T05:34:41.791Z”,“pid”:2362321,“hostname”:“ESEPAPLDAP016.pcop.ericsson.se”,“msg”:“Start of node method getElement”}
{“level”:30,“time”:“2026-05-29T05:34:41.791Z”,“pid”:2362321,“hostname”:“ESEPAPLDAP016.pcop.ericsson.se”,“msg”:“Strict mode is enabled, find Locator with id=content >> internal:control=enter-frame >> xpath=//*[@id=“mx_objectCount”] in page.”}
{“level”:30,“time”:“2026-05-29T05:36:11.794Z”,“pid”:2362321,“hostname”:“ESEPAPLDAP016.pcop.ericsson.se”,“msg”:“Error of node method getElement”}
================= Original suppressed error =================
locator.waitFor: Timeout 90000ms exceeded.
Call log:

  • waiting for locator(‘id=content’).contentFrame().locator(‘//*[@id=“mx_objectCount”]’)

    at getElement (/home/pucaoacnt/.local/lib/python3.9/site-packages/Browser/wrapper/index.js:11486:17)
    at async PlaywrightServer.getElement (/home/pucaoacnt/.local/lib/python3.9/site-packages/Browser/wrapper/index.js:13510:28) {
    name: ‘TimeoutError’
    }

I’m running robot-framework 7.3.2 and robotframework-browser 19.9.0. The headless browser is opened with the same kind of arguments in both cases (Selenium and Browser).

Selenium:
${HEADLESS OPTIONS} add_argument(“–headless=new”);add_argument(“–disable-popup-blocking”);add_argument(“–ignore-certificate-errors”);add_argument(“–allow-running-insecure-content”);add_argument(“–disable-web-security”);add_argument(“–no-sandbox”)

Browser:
${HEADLESS OPTIONS} [“–headless”, “–disable-popup-blocking”, “–ignore-certificate-errors”, “–allow-running-insecure-content”, “–disable-web-security”, “–no-sandbox”]

I’m suspecting that the problem may be linked to the OS. I’m running Robot Framework on Red Hat Enterprise Linux release 9.7 (Plow) and while Robot Framework itself does not care which OS it’s running on as long as it has got Python, Playwright does not officially support RHEL.

There is no error message pointing to anything except the regular timeout when the element on the landing page cannot be found. I guess Robot Framework with the Browser library has not been verified on RHEL.

Hi Mats,

I took the time to read your question, unfortunately I don’t have a good answer for you.

I have run both Selenium and Browser library without issue on Linux, but I only really used Debian based distro’s (mostly Debian or Ubuntu).

The fact you got the login page opened indicates that an OS issue is less likely, there are common issues with running these libraries on Linux, mostly people don’t realise they need a display server even when running headless, but you seem to have that in place (or you wouldn’t have gotten to the login page)

You didn’t mention your NodeJS version, I know playwright can be picky about this, but usually for me it would complain before getting the browser open, so I’m guessing you have a supported version of NodeJS.

Some questions that may help:

  • Is switching to a Debian based distro an option? or are you constrained by a corporate policy?
  • is running your tests in a docker container an option? there are docker templates with robot framework, Browser Library, etc all pre setup for you. I’m no expert in this area as I don’t really use docker myself, but sometimes this can be a useful approach.
  • are you able to log onto the machine and run the test with headless=false to observe what happens? this might give you a clue.
  • I’m assuming you are comparing Selenium vs Browser using the same browser, i.e. Chrome for both? have you tried with a different browser (like Firefox) with both to see if you get the same behaviour? (this could help with troubleshooting). I know playwright ships it’s own version of the browsers rather than using whatever is installed on the OS (Selenium approach) so maybe it’s a difference in the browser version and you’ve stumbled across a weird bug in that version of the bowser you’re using (just a guess)

Hopefully this is helpful, sorry I can’t give a better answer,

Dave.

Thank you Dave for your comments.

My NodeJS version is v18.20.8.

Unfortunately my environment is quite rigid so I cannot run in headed mode or upgrade/downgrade components myself.

The screenshots show that the login page is displayed properly while nothing is displayed after submitting the user & password. The screenshot just shows an entirely blue screen while the url points to a problem with the authentication. So Playwright looks to be working as such.

I will need to contact our infra team to see if we can find a way forward. I don’t think I can get another OS but perhaps a docker container with Ubuntu can be created. It’s strange that I don’t receive any kind error message from Playwright when the authentication fails.

I wouldn’t be suprised of the site detects the playwright and then blocks the automation.

I would start debugging this by getting the har logs from playwright and also enable video recording for it to see what’s happening, not just few screenshots ..

Thank You Rasjani for your comment.

I think you are quite right. I pulled a Robot Framework Docker image with the latest RF & RF Browser, preinitialized browsers and other dependencies. When running the test from inside a Docker container I got the very same result as before which basically rules out everything on the local side.

It must be that the target server detects Playwright as you suspected and blocks it as a security measure. So now I know how to carry on with this problem.

Best Regards,
Mats

I think this is an issue with the provided browsers - they do not like single sign on (at least it looks to me like you are trying to use SSO).
Try open the browser with the following options:

New Persistent Context
… args=${Browser_args}
… baseURL=${site_url}
… browser=chromium
… channel=chrome

For Playwright there was a discussion that “persistent context” was needed with SSO and “channel” too, because otherwise security settings are too stringend.
The discussion concerning “Persistent Context” can be found here: [Bug]: Playwright browsers keeps triggering Windows Credentials via SSO · Issue #33850 · microsoft/playwright · GitHub

Regards,

Thank you for your reply TorSte, it was really useful.

The server is a 3rd Party Product used for product handling and I don’t think it uses SSO. In any case your reply made me try the same keywords as before but with the channel parameter added to the New Browser keyword and with that addition the login started working.

So for some reason Playwright has to operate against the local Chrome/Edge browser rather than the chromium build. I don’t know why that is but I’m happy to get the login to work.

BR,
Mats