microsoft / playwright-python

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

[BUG]Cannot run "python -m playwright install" properly #2017

Closed jasonyangmx closed 1 year ago

jasonyangmx commented 1 year ago

System info

Maybe this was because the path I installed contains parentheses. I installed python in "D:\Progam(x86)", and the playwright program was in "D:\Program(x86)\Python39-32\Scripts\". I think that may be somehow related to the problem.

Thank you!

Source code

Link to the GitHub repository with the repro

[https://github.com/your_profile/playwright_issue_title]

or

Config file

// playwright.config.ts
import { defineConfig, devices } from '@playwright/test';

export default defineConfig({
  projects: [
    {
      name: 'chromium',
      use: { ...devices['Desktop Chrome'], },
    },
});

Test file (self-contained)

it('should check the box using setChecked', async ({ page }) => {
  await page.setContent(`<input id='checkbox' type='checkbox'></input>`);
  await page.getByRole('checkbox').check();
  await expect(page.getByRole('checkbox')).toBeChecked();
});

Steps

Expected

[Describe expected behavior]

Actual

[Describe actual behavior]

mxschmitt commented 1 year ago

I tried to reproduce, but was unfortunately not able to. Are you using a virtualenv?

jasonyangmx commented 1 year ago

I tried to reproduce, but was unfortunately not able to. Are you using a virtualenv?

No, I'm not using virtualenv.

Here's the log (Things were the same as I started cmd under Administrator's mode):


Microsoft Windows [版本 10.0.22621.1992] (c) Microsoft Corporation。保留所有权利。

C:\Users\Jason>pip list Package Version  ------------------ ------- colorama 0.4.6 docx 0.2.4 et-xmlfile 1.1.0 fuzzywuzzy 0.18.0 greenlet 2.0.2 jieba 0.42.1 Levenshtein 0.21.1 lxml 4.9.2 numpy 1.24.3 openpyxl 3.0.10 pandas 2.0.1 Pillow 9.5.0 pip 23.2.1 playwright 1.35.0 pyee 9.0.4 PyPDF2 3.0.1 pypiwin32 223 python-dateutil 2.8.2 python-Levenshtein 0.21.1 pytz 2023.3 pywin32 305 rapidfuzz 3.1.1 setuptools 68.0.0 six 1.16.0 tqdm 4.64.1 typing_extensions 4.4.0 tzdata 2023.3 xlrd 2.0.1

C:\Users\Jason>where python D:\Program(x86)\Python39-32\python.exe C:\Users\Jason\AppData\Local\Microsoft\WindowsApps\python.exe

C:\Users\Jason>python -m playwright install 'D:\Program' 不是内部或外部命令,也不是可运行的程序 或批处理文件。

C:\Users\Jason>


mxschmitt commented 1 year ago

Yeah looks like something is messed up on your system. We strongly recommend to use virtualenv, so dependencies are not installed globally, don't run it in administrator mode and recommend a more recent Python version.

Closing for now since we were not able to reproduce it.