admin管理员组文章数量:1291030
I'm trying to learn Playwright, so I was checking Playwright Inspector concept and written below piece of code. In Pycharm terminal I run the below i.e. set PWDEBUG=1 and use pytest
PWDEBUG=1 pytest -s test_saucedemo.py
I get error message
PWDEBUG=1 : The term 'PWDEBUG=1' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the
name, or if a path was included, verify that the path is correct and try again.
Note: Path of the file is proper because when I run as pytest -s test_saucedemo.py
test is passed.
import pytest
from playwright.sync_api import Page,expect
def test_page_title(page:Page):
page.goto(".html") #pytest --base-url
expect(page).to_have_title("Swag Labs")
page.get_by_placeholder("Username").fill("standard_user")
page.get_by_placeholder("Password").fill("secret_sauce")
page.locator("input.btn_action").click()
I'm trying to learn Playwright, so I was checking Playwright Inspector concept and written below piece of code. In Pycharm terminal I run the below i.e. set PWDEBUG=1 and use pytest
PWDEBUG=1 pytest -s test_saucedemo.py
I get error message
PWDEBUG=1 : The term 'PWDEBUG=1' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the
name, or if a path was included, verify that the path is correct and try again.
Note: Path of the file is proper because when I run as pytest -s test_saucedemo.py
test is passed.
import pytest
from playwright.sync_api import Page,expect
def test_page_title(page:Page):
page.goto("https://www.saucedemo/v1/index.html") #pytest --base-url https://www.saucedemo
expect(page).to_have_title("Swag Labs")
page.get_by_placeholder("Username").fill("standard_user")
page.get_by_placeholder("Password").fill("secret_sauce")
page.locator("input.btn_action").click()
Share
Improve this question
edited Feb 14 at 6:10
ggorlen
57.3k8 gold badges110 silver badges154 bronze badges
asked Feb 13 at 16:39
user166013user166013
1,5035 gold badges22 silver badges38 bronze badges
1 Answer
Reset to default 1The command you are executing to start your tests is using POSIX shell syntax for setting the environment variable PWDEBUG
, but you seem to be executing it in a PowerShell.
The PowerShell syntax is a bit different. Try executing the following command instead:
$Env:PWDEBUG = 1; pytest -s test_saucedemo.py
See the question PowerShell: Setting an environment variable for a single command only.
本文标签: pythonUnable to run Playwright test scripts in debug ModeStack Overflow
版权声明:本文标题:python - Unable to run Playwright test scripts in debug Mode - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741516566a2382925.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论