microsoft / playwright-python

Python version of the Playwright testing and automation library.
https://playwright.dev/python/
Apache License 2.0
11.64k stars 883 forks source link

Is is possible to run playwright-codegen command with chrome browser? #348

Closed hobin2017 closed 3 years ago

hobin2017 commented 3 years ago

The version of chrome browser is 86.0.4240.198. The command below does not have the browser-related option.

py -3.7 -m playwright codegen -h
kumaraditya303 commented 3 years ago

@hobin2017 You can use the browser option to set browser. Use -b flag followed by the browser name firefox for firefox otr webkit for webkit

Only valid browsers are chromium , firefox and webkit.

Here a minimal example -

$ python -m playwright codegen -b firefox 

Similarly for webkit it would be -

$ python -m playwright codegen -b webkit
hobin2017 commented 3 years ago

@kumaraditya303 Can it be configuired to use the executablePath option of playwright.sync_playwright.chromium.launch method?

pavelfeldman commented 3 years ago

This is not currently supported. Could you share why you need it? Media codecs or something like that?

hobin2017 commented 3 years ago

The work about codegen is amazing. However, there is no matched browser in my computer. It would be nicer if running the demo-code succssfully after pip install playwright.

kumaraditya303 commented 3 years ago

@hobin2017 You can install the browsers using python -m playwright install

quidnu commented 3 years ago

Is it possible to change the device to mobile?

mxschmitt commented 3 years ago

@quidnu yes, you can specify it with the --device parameter, see here for examples: https://github.com/microsoft/playwright-cli#emulate-devices

pavelfeldman commented 3 years ago

Looks like the issue was resolved, please open new bugs if there are still problems!

Louis24 commented 3 months ago

This is not currently supported. Could you share why you need it? Media codecs or something like that?

cuz, some cookies and plugins have install on that google chrome.