I’ve been working with Playwright over the past few months and have noticed this frequently. I often have to rely on CSS locators and XPath as a last resort due to this limitation. Thanks for sharing!
Don't use XPath in the Playwright. It's considered the anti-pattern. Instead, use user-visible locators such as getByRole(). With some practice, you will quickly understand that it's significantly more convenient than XPath. The "SDET with Playwright" course has a separate section on how to find web elements in Playwright following best practices.
I am afraid you can't. This is a Playwright plugin for the VS Code, and as far as I know, Playwright does not have plugins for pycharm. But, you still can use a locator picker running the Playwright's UI mode, which I also show in the video.
It's the same functionality, just a different interface. With a debugger you need to run tests running inspector, which is one extra window. With VS Code extension, it's just a little bit more convenient scripting the locator for the next step of the test in my oppinion.
I’ve been working with Playwright over the past few months and have noticed this frequently. I often have to rely on CSS locators and XPath as a last resort due to this limitation.
Thanks for sharing!
Don't use XPath in the Playwright. It's considered the anti-pattern. Instead, use user-visible locators such as getByRole(). With some practice, you will quickly understand that it's significantly more convenient than XPath. The "SDET with Playwright" course has a separate section on how to find web elements in Playwright following best practices.
Really cool,
How can we do the same using Pycharm?
I am afraid you can't. This is a Playwright plugin for the VS Code, and as far as I know, Playwright does not have plugins for pycharm. But, you still can use a locator picker running the Playwright's UI mode, which I also show in the video.
Cool. What is this one's advantage over playwright debugger? Which streamlines the locators as a user interaction flow?
It's the same functionality, just a different interface. With a debugger you need to run tests running inspector, which is one extra window. With VS Code extension, it's just a little bit more convenient scripting the locator for the next step of the test in my oppinion.