Skip to content
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] Use different browser with recorder in vscode #24276

Closed
morganBlanloeil opened this issue Jul 18, 2023 · 12 comments
Closed

[BUG] Use different browser with recorder in vscode #24276

morganBlanloeil opened this issue Jul 18, 2023 · 12 comments

Comments

@morganBlanloeil
Copy link

Context:

  • Playwright Version: 1.36
  • Operating System: Linux or Windows
  • Node.js version: 16.18.1
  • Visual Studio Code version: 1.80.0
  • Playwright for VSCode extension version: 1.0.14
  • Browser: All

Code Snippet
` /* Configure projects for major browsers */
projects: [

{
  name: 'firefox',
  use: { ...devices['Desktop Firefox'] },
},
{
  name: 'chromium',
  use: { 
    ...devices['Desktop Chrome'],
  }
}`

Describe the bug

When I run "Record New" from intergration playwright to vscode, vscode run always chromium despite of choose default profile as firefox. How to force vscode to use firefox instead of chrome ?

@morganBlanloeil morganBlanloeil changed the title [BUG] [BUG] Use different browser with recorder in vscode Jul 18, 2023
@mxschmitt
Copy link
Member

mxschmitt commented Jul 18, 2023

To use a different browser, aka. the browser which you last time ran your tests with do the following:

  1. Make sure "Show browser" is checked.
  2. Change the default profile in VSCode if you want to use a different browser:
    Screenshot 2023-07-18 at 11 28 10
  3. Run some test
  4. Click on Record New

Then the browser from the last test run with its configuration gets used. Would that work for you?

@morganBlanloeil
Copy link
Author

Thanks for your quick answer, but this solution don't working for me, vscode run always chromium

@aslushnikov
Copy link
Collaborator

@morganBlanloeil could you please record & show us video, that demonstrates your playwright.config.ts, your default profile, and how you run code generation?

@morganBlanloeil
Copy link
Author

Sure,

My playwright config :

`import { defineConfig, devices } from '@playwright/test';

export default defineConfig({
testDir: './tests',
reporter: 'html',
use: {
headless: false,
trace: 'on-first-retry',
},

/* Configure projects for major browsers */
projects: [

{
  name: 'firefox',
  use: { ...devices['Desktop Firefox'] },
},
{
  name: 'chromium',
  use: {
    ...devices['Desktop Chrome'],
  }
}

],
});
`

And record attached
record_playwright

@mxschmitt
Copy link
Member

The issue is that you need to have "Show browser" checked, then the browser stays open and it will work:
image

@morganBlanloeil
Copy link
Author

Ok thanks it's work .
You know il an issue is planned for launch the correct browser without run test before ?

@aslushnikov
Copy link
Collaborator

@morganBlanloeil out of curiosity, why do you need specifically Firefox when recording?

@morganBlanloeil
Copy link
Author

I need to use firefox with my local environment, because,even if chrome is running in privacy mode, it use WIA (Integrated Windows Authentication) and we use another user for our tests. So we use firefox to bypass this. If you have another solution, i take it :)

@aslushnikov
Copy link
Collaborator

I see, thank you for sharing. I'll close this then given that workaround works for you!

@SD1982
Copy link

SD1982 commented Mar 15, 2024

Hello @aslushnikov
I have the same issue than @morganBlanloeil with the same configuration even with the "show browser" option checked
here is the recording

output_video.mp4

@mxschmitt
Copy link
Member

@SD1982 looks like this is about #26777 - you need to execute a test with your preferred configuration first until we have fixed the issue.

@SD1982
Copy link

SD1982 commented Mar 15, 2024

It worked with this 👍
i will use it like this for now and I will follow #26777 to know when it's fixed 👍
Thanks @mxschmitt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants