-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: When using robotframework browserlibrary, "useragent" passed is not honored when using "webkit" browser #29629
Comments
Can you / they provide a playwright example that we could run locally to reproduce the issue? |
@yury-s I wish I could help, but I am unfamiliar with using playwright. By passing a user agent, loading any url on webkit browser should reproduce the issue. I am using the following code on the robotframework to reproduce the issue: *** Settings *** *** Keywords *** load_the_application_on_incognito_mode In playwright, I think we could try the following code: const { webkit } = require('playwright');
(async () => {
// Launch the Webkit browser
const browser = await webkit.launch();
const context = await browser.newContext({
userAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.0 Safari/605.1.15',
});
// Create a new page in the browser context and navigate to target URL
const page = await context.newPage();
await page.goto('https://httpbin.io/user-agent');
// Get the entire page content
const pageContent = await page.content();
console.log(pageContent);
// Close the browser
await browser.close();
})(); Please let me know, if any other info is needed. Thanks. |
I cannot reproduce it with the example you provided, so there must be something else. Make sure the framework is running latest playwright (1.41.2 currently). Unfortunately, we cannot act on this without a reproduction. |
Hello @yury-s We just install NodeJs and don’t install playwright explicitly to use BrowserLibrary in our test automation framework. Yury/Tato – Any advice on how to proceed with MarketSquare/robotframework-browser#3383 |
As I mentioned above we'll need a reproduction example with playwright that we could run locally. The basic example you pasted above works just fine. So I'd assume that it might be a bug in some old version of playwright or something on the way those parameters are passed to playwright, but this is all speculation. I'm closing this bug as we cannot act on it, but feel free to open a new one and attach a playwright example where the problem appears. |
Version
NodeJS version: v18.17.1
Steps to reproduce
Desktop (please complete the following information):
robotframework==6.1.1
robotframework-browser: 17.3.0
Browser: Webkit
NodeJS version: v18.17.1
npm version: 9.6.7
Steps to reproduce:
Invoke any url using browserlibrary from robotframework. Used the following code to invoke the app
New Persistent Context url=${url} browser=${execution_browser} userAgent=${userAgent} viewport=${viewport}
url - "https://pwa-br-us-a.qa.tillster.com/"
browser - "webkit"
user agent - Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.0 Safari/605.1.15
viewport - "{'width': 810, 'height': 1010}"
Issue:
When "webkit" is used, user agent provided in the script is not used when loading the application.
In the screenshot, mac useragent "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.0 Safari/605.1.15" is provided in the script . However, the application is loaded with Windows user agent, as the test is run on windows machine.
This is not an issue when using "chromium" browser. App is loaded with whatever useragent passed in the automation script.
Please let me know, if additional info is needed.
chromium.webm.zip
webkit.webm.zip
Expected behavior
In the screenshot above, mac useragent "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.0 Safari/605.1.15" is provided in the script . Expected to see the same useragent for loading the app.
Actual behavior
In the screenshot, mac useragent "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.0 Safari/605.1.15" is provided in the script . However, the application is loaded with Windows user agent, as the test is run on windows machine.
Additional context
I opened a bug to Robotframework-browser support team and they suggested to open a ticket to playwright, as browser library passes that value to playwright without altering it.
MarketSquare/robotframework-browser#3383
Environment
The text was updated successfully, but these errors were encountered: