profile
viewpoint
Arjun Attam arjun27 Microsoft Vancouver, BC https://arjun.is Program Manager on Playwright @microsoft

arjun27/gitstats 2

Weekly git stats for your engineering team

arjun27/calculator 1

Simple calculator built with React

arjun27/advent-of-code-clojure 0

Learning Clojure with Advent of Code 2018

arjun27/awesome-code-review 0

An "Awesome" list of code review resources - articles, papers, tools, etc

arjun27/azure-maven-plugins 0

Maven plugins for Azure

arjun27/azure-sdk-for-java 0

Azure SDKs for Java

push eventarjun27/playwright-1

Arjun Attam

commit sha 52152374615aced91c533a1d7d3beec8a277adfb

docs(emulation): separate section for dark mode

view details

push time in 15 hours

push eventarjun27/playwright-1

Arjun Attam

commit sha 5b6a34309b10556e322a3aad1368c1768bbb0174

docs(emulation): separate section for dark mode

view details

push time in 16 hours

PR opened microsoft/playwright

docs(emulation): separate section for dark mode

To improve discoverability of color scheme emulation

+28 -10

0 comment

1 changed file

pr created time in 17 hours

create barncharjun27/playwright-1

branch : dark-mode-docs

created branch time in 17 hours

issue closedmicrosoft/playwright

[BUG] Dangling context menu after right-click on WebKit headless Windows

Context:

  • Playwright Version: 1.1.1
  • Operating System: Windows (works on Mac)
  • Node version: 12.18
  • Browser: Webkit

Code Snippet

const {webkit} = require('playwright');

(async () => {
    const browser = await webkit.launch({headless: true});
    const context = await browser.newContext();
    const page = await context.newPage();
    await page.goto("https://www.bing.com");
    await page.click("//*[@id='b_logo']", {button: 'right'});
    await browser.close();
})();

Since the execution is headless, no UI should be shown

Screen Shot 2020-06-24 at 7 13 07 PM

closed time in a day

arjun27

issue commentmicrosoft/playwright

[BUG] Dangling context menu after right-click on WebKit headless Windows

Just tested this on 1.2 and it's been fixed

arjun27

comment created time in a day

issue commentvsls-contrib/chat

Chat causing "Extension host terminated unexpectedly." error.

Thanks @binury. Can you please share more info about your environment? What OS are you on?

JAZ-013

comment created time in a day

issue openedmicrosoft/playwright

[Feature] Support for touch events/gestures

Web apps running on touch devices (e.g, mobile and Surface) rely on touch gestures like swiping and pinching to zoom. While page.dispatchEvent can manufacture synthetic touch points, having a simpler API would improve the dev experience.

Scenarios

  1. Two-finger pinch to zoom in/out on a particular element (e.g., canvas in Azure ML designer)
  2. Verify that two-finger left/right swipe is not leading to go back/forward

created time in 2 days

issue openedmicrosoft/playwright

[Feature] Method to wait for event listeners to be attached

Not having event listeners attached in time is a common cause of flakiness. While page.click automatically checks for whether element is receiving events, it would be useful to expose a lower-level convenience method that can check whether a particular event listener has been attached. For example, the Azure ML designer can check whether mousemove listener is attached to an element.

cc @JYC-99

created time in 2 days

issue openedmicrosoft/playwright

[BUG] Chromium not launching on Windows

Context:

  • Playwright Version: 1.1.1
  • Operating System: Windows
  • Browser: Chromium

@JYC-99 is running into an issue launching Chromium on Windows. Reporting on his behalf.

Code Snippet

const playwright = require("playwright");

(async () => {
  const browser = await playwright.chromium.launch();
  const context = await browser.newContext()
  const page = await context.newPage();
  await page.goto('https://example.com');
  await page.screenshot({ path: `example.png` });
  await browser.close();
})();

Running with DEBUG=* reveals missing dlls (find lines with ERROR:dxva_video_decode_accelerator_win.cc). Relevant for #2745

pw:api => chromium.launch started +0ms
pw:browser <launching> C:\Users\yucongj\AppData\Local\ms-playwright\chromium-775089\chrome-win\chrome.exe --disable-background-networking --enable-features=NetworkService,NetworkServiceInProcess --disable-background-timer-throttling --disable-backgrounding-occluded-windows --disable-breakpad --disable-client-side-phishing-detection --disable-component-extensions-with-background-pages --disable-default-apps --disable-dev-shm-usage --disable-extensions --disable-features=TranslateUI,BlinkGenPropertyTrees,ImprovedCookieControls,SameSiteByDefaultCookies --disable-hang-monitor --disable-ipc-flooding-protection --disable-popup-blocking --disable-prompt-on-repost --disable-renderer-backgrounding --disable-sync --force-color-profile=srgb --metrics-recording-only --no-first-run --enable-automation --password-store=basic --use-mock-keychain --user-data-dir=C:\Users\yucongj\AppData\Local\Temp\playwright_chromiumdev_profile-UX5hK7 --remote-debugging-pipe --headless --hide-scrollbars --mute-audio --no-startup-window +0ms
pw:browser <launched> pid=8524 +408ms
pw:protocol SEND ► {"id":1,"method":"Target.setAutoAttach","params":{"autoAttach":true,"waitForDebuggerOnStart":true,"flatten":true}} +0ms
pw:protocol ◀ RECV {"id":1,"result":{}} +895ms
pw:api <= chromium.launch succeeded +1s
pw:protocol SEND ► {"id":2,"method":"Target.createBrowserContext","params":{"disposeOnDetach":true}} +2ms
pw:protocol ◀ RECV {"id":2,"result":{"browserContextId":"1F3605F4D9FE27D4DBE82D3E85E1099F"}} +2ms
pw:protocol SEND ► {"id":3,"method":"Browser.setDownloadBehavior","params":{"behavior":"deny","browserContextId":"1F3605F4D9FE27D4DBE82D3E85E1099F","downloadPath":"C:\\Users\\yucongj\\AppData\\Local\\Temp\\playwright_downloads-XaSJEs"}} +1ms
pw:protocol ◀ RECV {"id":3,"result":{}} +2ms
pw:protocol SEND ► {"id":4,"method":"Target.createTarget","params":{"url":"about:blank","browserContextId":"1F3605F4D9FE27D4DBE82D3E85E1099F"}} +2ms
pw:protocol ◀ RECV {"method":"Target.attachedToTarget","params":{"sessionId":"B27E73BB6CB069E1BE874710D51203FE","targetInfo":{"targetId":"CE1D0D93B69A01B41224728C1137F38B","type":"page","title":"","url":"","attached":true,"browserContextId":"1F3605F4D9FE27D4DBE82D3E85E1099F"},"waitingForDebugger":true}} +2ms
pw:protocol SEND ► {"id":5,"method":"Page.enable","sessionId":"B27E73BB6CB069E1BE874710D51203FE"} +3ms
pw:protocol SEND ► {"id":6,"method":"Page.getFrameTree","sessionId":"B27E73BB6CB069E1BE874710D51203FE"} +1ms
pw:protocol SEND ► {"id":7,"method":"Log.enable","params":{},"sessionId":"B27E73BB6CB069E1BE874710D51203FE"} +1ms
pw:protocol SEND ► {"id":8,"method":"Page.setLifecycleEventsEnabled","params":{"enabled":true},"sessionId":"B27E73BB6CB069E1BE874710D51203FE"} +1ms
pw:protocol SEND ► {"id":9,"method":"Runtime.enable","params":{},"sessionId":"B27E73BB6CB069E1BE874710D51203FE"} +0ms
pw:protocol SEND ► {"id":10,"method":"Page.addScriptToEvaluateOnNewDocument","params":{"source":"\n//# sourceURL=__playwright_evaluation_script__0\n","worldName":"__playwright_utility_world__"},"sessionId":"B27E73BB6CB069E1BE874710D51203FE"} +1ms
pw:protocol SEND ► {"id":11,"method":"Network.enable","sessionId":"B27E73BB6CB069E1BE874710D51203FE"} +1ms
pw:protocol SEND ► {"id":12,"method":"Target.setAutoAttach","params":{"autoAttach":true,"waitForDebuggerOnStart":true,"flatten":true},"sessionId":"B27E73BB6CB069E1BE874710D51203FE"} +1ms
pw:protocol SEND ► {"id":13,"method":"Emulation.setFocusEmulationEnabled","params":{"enabled":true},"sessionId":"B27E73BB6CB069E1BE874710D51203FE"} +0ms
pw:protocol SEND ► {"id":14,"method":"Emulation.setDeviceMetricsOverride","params":{"mobile":false,"width":1280,"height":720,"screenWidth":1280,"screenHeight":720,"deviceScaleFactor":1,"screenOrientation":{"angle":90,"type":"landscapePrimary"}},"sessionId":"B27E73BB6CB069E1BE874710D51203FE"} +0ms
pw:protocol SEND ► {"id":15,"method":"Emulation.setGeolocationOverride","params":{},"sessionId":"B27E73BB6CB069E1BE874710D51203FE"} +2ms
pw:protocol SEND ► {"id":16,"method":"Network.setExtraHTTPHeaders","params":{"headers":{}},"sessionId":"B27E73BB6CB069E1BE874710D51203FE"} +0ms
pw:protocol SEND ► {"id":17,"method":"Network.emulateNetworkConditions","params":{"offline":false,"latency":0,"downloadThroughput":-1,"uploadThroughput":-1},"sessionId":"B27E73BB6CB069E1BE874710D51203FE"} +2ms
pw:protocol SEND ► {"id":18,"method":"Emulation.setEmulatedMedia","params":{"media":"","features":[{"name":"prefers-color-scheme","value":"light"}]},"sessionId":"B27E73BB6CB069E1BE874710D51203FE"} +1ms
pw:protocol SEND ► {"id":19,"method":"Runtime.runIfWaitingForDebugger","sessionId":"B27E73BB6CB069E1BE874710D51203FE"} +1ms
pw:protocol ◀ RECV {"id":4,"result":{"targetId":"CE1D0D93B69A01B41224728C1137F38B"}} +1ms
pw:protocol ◀ RECV {"id":15,"result":{},"sessionId":"B27E73BB6CB069E1BE874710D51203FE"} +1ms
pw:browser:err [0710/094000.057:ERROR:dxva_video_decode_accelerator_win.cc(1368)] DXVAVDA fatal error: could not LoadLibrary: mf.dll: The specified module could not be found. (0x7E) +0ms
pw:browser:err [0710/094000.058:ERROR:dxva_video_decode_accelerator_win.cc(1368)] DXVAVDA fatal error: could not LoadLibrary: mfplat.dll: The specified module could not be found. (0x7E) +1ms
pw:browser:err [0710/094000.059:ERROR:dxva_video_decode_accelerator_win.cc(1368)] DXVAVDA fatal error: could not LoadLibrary: msmpeg2vdec.dll: The specified module could not be found. (0x7E) +1ms
pw:browser:err [0710/094000.060:ERROR:dxva_video_decode_accelerator_win.cc(1376)] DXVAVDA fatal error: could not LoadLibrary: msvproc.dll: The specified module could not be found. (0x7E) +0ms
pw:protocol ◀ RECV {"method":"Network.loadingFailed","params":{"requestId":"189AFF5D97B7DD4C922DFB96E1BB34CD","timestamp":1773229.832268,"type":"Document","errorText":"net::ERR_ABORTED","canceled":true},"sessionId":"B27E73BB6CB069E1BE874710D51203FE"} +805ms
pw:protocol ◀ RECV {"id":12,"result":{},"sessionId":"B27E73BB6CB069E1BE874710D51203FE"} +1ms
pw:protocol ◀ RECV {"method":"Inspector.targetCrashed","params":{},"sessionId":"B27E73BB6CB069E1BE874710D51203FE"} +1m

created time in 2 days

issue closedmicrosoft/playwright

[Feature] page.waitForSelector("td.value:contains('111222')")

Hi Team,

does Playwright support contains(text)?

Element: <td class="value">111222</td>

Function: await page.waitForSelector("td.value:contains('111222')")

Error: UnhandledPromiseRejectionWarning: Error: Evaluation failed: DOMException: Failed to execute 'querySelectorAll' on 'Document': 'td.value:contains('108779')' is not a valid selector.

any workaround?

tnx a lot

closed time in 2 days

osmenia

issue commentmicrosoft/playwright

[Feature] page.waitForSelector("td.value:contains('111222')")

@osmenia, the built-in text selector can check for contains. Did you try something like page.waitForSelector('text=111222')? Learn more about selectors in the link below.

https://playwright.dev/#version=v1.2.0&section=selector-engines

osmenia

comment created time in 2 days

issue commentmicrosoft/playwright

[Question] Is it possible to run Playwright tests on real mobile device browsers?

Thanks @Filipoliko. I just tried running this case with iPhone emulation on Playwright WebKit and I'm able to repro this issue. Chrome mobile emulation is not reproducing it, as you've rightly pointed it out. Also, you're right about an invisible overlapping element (which is why I had to use force: true to issue the click). Sharing code below in case you'd like to try it out.

const { webkit, devices } = require('playwright');

(async() => {
  const browser = await webkit.launch({headless: false});
  const context = await browser.newContext({...devices['iPhone 11 Pro']});
  const page = await context.newPage();
  await page.goto('https://www.seznamzpravy.cz/clanek/v-korupcni-kauze-stoka-obvinila-policie-dalsi-27-lidi-111820');
  await page.click('[data-dot="ogm-breadcrumb-navigation"] >> text=Domácí', {force: true});
})();

Screen Shot 2020-07-08 at 9 34 53 AM

Cosmin-Gramada

comment created time in 3 days

push eventmicrosoft/playwright

Arjun Attam

commit sha 6a1bd3ae6edc3583534907ab3f8a815049e87c7c

docs: add debugging docs page (#2865)

view details

push time in 3 days

push eventarjun27/playwright-1

Arjun Attam

commit sha 66d07a64f75a217e65f48b9ace8cf949385f5d83

docs: add debugging docs page

view details

push time in 4 days

Pull request review commentmicrosoft/playwright

docs: add content for debugging tools

+# Debugging tools++Playwright scripts work with existing debugging tools, like Node.js debuggers+and browser developer tools. Playwright also introduces new debugging features+for browser automation.++<!-- GEN:toc -->+- [Run in headful mode](#run-in-headful-mode)+- [Visual Studio Code debugger](#visual-studio-code-debugger)+  * [Use launch config](#use-launch-config)+  * [Use the new JavaScript debugger](#use-the-new-javascript-debugger)+- [Browser Developer Tools](#browser-developer-tools)+  * [API for Chromium](#api-for-chromium)+- [Run in Debug Mode](#run-in-debug-mode)+  * [Defaults](#defaults)+  * [Debugging Selectors](#debugging-selectors)+  * [Evaluate Source Maps](#evaluate-source-maps)+- [Verbose API logs](#verbose-api-logs)+<!-- GEN:stop -->++## Run in headful mode++Playwright runs browsers in headless mode by default. To change this behavior,+use `headless: false` as a launch option. You can also use the `slowMo` option+to slow down execution and follow along while debugging.++```js+await chromium.launch({ headless: false, slowMo: 100 }); // or firefox, webkit+```++## Visual Studio Code debugger++The VS Code debugger can be used to pause and resume execution of Playwright+scripts with breakpoints. The debugger can be configured in two ways.++### Use launch config++Setup [`launch.json` configuration](https://code.visualstudio.com/docs/nodejs/nodejs-debugging)+for your Node.js project. Once configured launch the scripts with F5 and use+breakpoints.++### Use the new JavaScript debugger++VS Code 1.46+ introduces the new JavaScript debugger behind a feature flag. The+new debugger does not require a `launch.json` configuration. To use this:++1. Enable the preview debugger+    * Open JSON settings and add `"debug.javascript.usePreview": true`+    * Open settings UI and enable the `Debug › JavaScript: Use Preview` setting++1. Set a breakpoint in VS Code+    * Use the `debugger` keyword or set a breakpoint in the VS Code UI++1. Run your Node.js script from the terminal

from what I can tell, vscode 1.46+ does not require a special terminal

arjun27

comment created time in 4 days

push eventarjun27/playwright-1

Arjun Attam

commit sha 7e568796cda2e67bc2bfbbcdf948b4a57ff3af10

docs: add debugging docs page

view details

push time in 4 days

PR opened microsoft/playwright

docs: add content for debugging tools
+142 -30

0 comment

4 changed files

pr created time in 4 days

create barncharjun27/playwright-1

branch : docs-debug-1

created branch time in 4 days

issue commentmicrosoft/playwright

Page Object Model [Question]

Hi @randomactions, the best approach would depend on your use-case. Couple of approaches to consider:

  • Use class inheritance and create base page classes that define common methods
  • Define utility methods separately and import them inside page objects
tomern

comment created time in 4 days

startedmicrosoft/playwright-python

started time in 4 days

delete branch arjun27/playwright-1

delete branch : readme-geo

delete time in 5 days

issue commentmicrosoft/playwright

[Investigate] Support for AWS Lambda / Serverless environments

@CyberV, thanks for the comment. This is the current state of running Playwright on Azure Functions:

  • Azure Functions Linux: Chromium can run on the Linux consumption (basic) plan, without any additional dependencies. Firefox and WebKit require the Linux premium plan, with a custom docker setup. @mxschmitt has shared an example above.
  • Azure Functions Windows: running headless browsers is not supported, due to missing Windows libs.

Are you running on Windows?

mxschmitt

comment created time in 5 days

startedmxschmitt/heroku-playwright-buildpack

started time in 5 days

PR opened microsoft/playwright

docs(readme): add locale to geo example

In non-English locales, page.click('text="Your location"') fails. This change configures the context to use en-US.

+1 -0

0 comment

1 changed file

pr created time in 5 days

create barncharjun27/playwright-1

branch : readme-geo

created branch time in 5 days

delete branch microsoft/playwright

delete branch : arjun27-patch-1

delete time in 5 days

create barnchmicrosoft/playwright

branch : arjun27-patch-1

created branch time in 5 days

issue commentmicrosoft/playwright

[BUG] Chromium headless on Windows does not launch without --disable-gpu

Attached logs from about:gpu

gpu.html.zip

arjun27

comment created time in 9 days

issue commentmicrosoft/playwright

[BUG] Cannot read property 'message' of undefined - When launching browser

thanks. I'm afraid we haven't tested running on CentOS. I would recommend following this to debug the issue with browser launches: https://playwright.dev/#version=master&path=docs%2Fci.md&q=debugging-browser-launches

skreeeeee

comment created time in 11 days

startedabhinaba-ghosh/axe-playwright

started time in 12 days

push eventmicrosoft/playwright

Arjun Attam

commit sha e154e0837b324c0ef621a3b956655319c3727df5

docs(ci): fix gitlab setup

view details

push time in 12 days

delete branch arjun27/playwright-1

delete branch : multi-page

delete time in 12 days

push eventmicrosoft/playwright

Arjun Attam

commit sha c8076121e2214cd91af5d2b58070c1196da4af5d

docs: add new doc for multi-page scenarios (#2737) * docs: multi-page scenarios * docs: multi-page scenarios * docs: multi-page scenarios

view details

push time in 12 days

PR merged microsoft/playwright

docs: add new doc for multi-page scenarios

Closes #2602

+123 -0

0 comment

3 changed files

arjun27

pr closed time in 12 days

issue closedmicrosoft/playwright

How to handle multiple pages

When I use playwright to open the page1.html, in this page I have a link to open page2.html in the new tab/window. So how can I handle this one? In puppeteer, I remember that have this method:

page.once('targetcreated', async target => {
	const newPage = await target.page() // <== this is new page object and we can take action on this
})

closed time in 12 days

phileba

Pull request review commentmicrosoft/playwright

docs: add new doc for multi-page scenarios

+# Multi-page scenarios++Playwright can automate scenarios that span multiple browser contexts or multiple+tabs in a browser window.++<!-- GEN:toc-top-level -->+- [Multiple contexts](#multiple-contexts)+- [Multiple pages](#multiple-pages)+- [Handling new pages](#handling-new-pages)+- [Handling popups](#handling-popups)+<!-- GEN:stop -->++## Multiple contexts++[Browser contexts](core-concepts.md#browser-contexts) are isolated environments+on a single browser instance. Playwright can create multiple browser contexts+within a single scenario. This is useful when you want to test for+multi-user functionality, like chat.++```js+const { chromium } = require('playwright');++// Create a Chromium browser instance+const browser = await chromium.launch();++// Create two isolated browser contexts+const userContext = await browser.newContext();+const adminContext = await browser.newContext();++// Load user and admin cookies+await userContext.addCookies(userCookies);+await adminContext.addCookies(adminCookies);+```++#### API reference++- [class `BrowserContext`](./api.md#class-browsercontext)+- [`browser.newContext([options])`](./api.md#browsernewcontextoptions)+- [`browserContext.addCookies(cookies)`](api.md#browsercontextaddcookiescookies)++## Multiple pages++Each browser context can host multiple pages (tabs).++* Each page behaves like a focused, active page. Bringing the page to front+  is not required.+* Pages inside a context respect context-level emulation, like viewport sizes,+  custom network routes or browser locale.++```js+// Create two pages+const pageOne = await context.newPage();+const pageTwo = await context.newPage();++// Get pages of a brower context+const allPages = await context.pages();+```++#### API reference++- [class `Page`](./api.md#class-page)+- [`browserContext.newPage()`](./api.md#browsercontextnewpage)+- [`browserContext.pages()`](./api.md#browsercontextpages)++## Handling new pages++The `page` event on browser contexts can be used to get new pages that are+created in the context. This can be used to handle new pages opened by+`target="_blank"` links.++```js+// Get page after a specific action (e.g. clicking a link)+const [newPage] = await Promise.all([+  context.waitForEvent('page'),+  page.evaluate(() => window.open('https://google.com', '_blank'))+])+console.log(await newPage.title());

Thanks. Updated to use newPage.waitForLoadState() since that covers more scenarios for the audience of a guide like this.

arjun27

comment created time in 12 days

push eventarjun27/playwright-1

Arjun Attam

commit sha de182ec15b99a445a1bdee4602d579c2b1b005e4

docs: multi-page scenarios

view details

push time in 12 days

delete branch arjun27/playwright-1

delete branch : docker-docs-1

delete time in 12 days

push eventmicrosoft/playwright

Arjun Attam

commit sha 69127ad8d314f7350291b81b7c45a3664f2784e3

docs(docker): update to use official image (#2760)

view details

push time in 12 days

PR merged microsoft/playwright

docs(docker): update to use official image

closes #1482

+54 -12

0 comment

2 changed files

arjun27

pr closed time in 12 days

issue closedmicrosoft/playwright

[Feature] official Docker image on Docker Hub

I saw somewhere the discussion that it's still an ongoing process. But I would maybe keep this issue open until it's published under the Microsoft Docker Hub account.

closed time in 12 days

mxschmitt

pull request commentmicrosoft/playwright

chore(devops): restructured / added Dockerfiles for Debian and Ubuntu 20

Thanks @mxschmitt! I pushed some docs changes in #2760, and it might be worth rebaselining over it.

I'm personally not sure giving these options. My concern is the maintenance overhead of these variations: we would want to dogfood them on our CI to ensure they keep working. I haven't seen user interest in such flexibility. There has been user interest in docker images that include browser binaries and I think that is a worthy enhancement over what we have. Open to more opinions on this however, I might be missing something.

Adding a Debian variation definitely helps users that are using existing images based on Debian (and cannot switch over to a different image altogether). Adding a reference dockerfile for them makes sense, but we should think about how to dogfood them before merging these – to ensure they don't deteriorate over time.

cc @aslushnikov

mxschmitt

comment created time in 12 days

PR opened microsoft/playwright

Reviewers
docs(docker): update to use official image

closes #1482

+54 -12

0 comment

2 changed files

pr created time in 12 days

create barncharjun27/playwright-1

branch : docker-docs-1

created branch time in 12 days

delete branch arjun27/playwright-1

delete branch : circle-docker

delete time in 12 days

push eventmicrosoft/playwright

Arjun Attam

commit sha 28a9f55a49e328c65d74cfcb687afb68f7f94c2d

chore(devops): use official docker image on circleci (#2756)

view details

push time in 12 days

issue commentmicrosoft/playwright

[Feature] official Docker image on Docker Hub

The official docker image is up! Find Playwright on the Docker Hub.

docker pull mcr.microsoft.com/playwright:bionic

I'll follow-up with a docs change and close this PR. Thank you for your patience, everyone :)

mxschmitt

comment created time in 12 days

create barncharjun27/playwright-1

branch : circle-docker

created branch time in 12 days

issue commentmicrosoft/playwright

[Feature] Launch doctor

In addition to finding missing dependencies, this tool can also check for OS compatibility: eg. Firefox needs Ubuntu 18+. For example: #2738.

pavelfeldman

comment created time in 12 days

issue commentmicrosoft/playwright

[BUG] Cannot read property 'message' of undefined - When launching browser

@wenfz, can you share more about the OS you're using? Firefox requires Ubuntu 18.04 and above.

skreeeeee

comment created time in 12 days

PR opened microsoft/playwright

docs: add new doc for multi-page scenarios

Closes #2602

+119 -0

0 comment

3 changed files

pr created time in 15 days

create barncharjun27/playwright-1

branch : multi-page

created branch time in 15 days

delete branch arjun27/playwright-1

delete branch : docs-ci-3

delete time in 15 days

push eventmicrosoft/playwright

Arjun Attam

commit sha aad6301aca621cbbea855945932c3ab991e3b71d

docs(ci): update intro, caching section, add gitlab (#2735)

view details

push time in 15 days

delete branch arjun27/playwright-1

delete branch : docs-frames

delete time in 15 days

push eventmicrosoft/playwright

Arjun Attam

commit sha 0cb5e95bdf056278b893956f89b8c2f61c429691

docs(frames): improve snippet to get frame (#2734)

view details

push time in 15 days

PR merged microsoft/playwright

docs(frames): improve snippet to get frame

Context: https://stackoverflow.com/questions/62596046/how-to-use-a-selector-finding-an-frame-iframe-using-playwright

+13 -9

0 comment

1 changed file

arjun27

pr closed time in 15 days

issue commentmicrosoft/playwright

[BUG] [FF, WK] TypeError: messages is not iterable

I'm running into the same error on the latest next: "playwright": "^1.1.0-next.1593217594450"

arjun27

comment created time in 15 days

PR opened microsoft/playwright

docs(ci): update intro, caching section, add gitlab

#2665

+33 -4

0 comment

1 changed file

pr created time in 15 days

create barncharjun27/playwright-1

branch : docs-ci-3

created branch time in 15 days

issue commentmicrosoft/playwright

[Question] Running on GitLab leads to WebSocket error: connect ECONNRESET 127.0.0.1:42495

Thanks @volekerb. I believe you had to add the additional step to install playwright again because of the caching behavior. We've documented this here, but perhaps there's a better way.

volekerb

comment created time in 15 days

PR opened microsoft/playwright

docs(frames): improve snippet to get frame

reason: https://stackoverflow.com/questions/62596046/how-to-use-a-selector-finding-an-frame-iframe-using-playwright

+13 -9

0 comment

1 changed file

pr created time in 15 days

create barncharjun27/playwright-1

branch : docs-frames

created branch time in 15 days

IssuesEvent

issue commentmicrosoft/playwright

[BUG] Webkit font rendering (spacing / icon fonts)

I'm facing a similar issue with WebKit on GitHub Actions, with Linux (build) and Windows (build). WebKit on macOS (build) is working. Link to app.

Sharing relevant screenshots from build artifacts below:

Webkit on macOS safari-map

Webkit on Windows safari-map

Webkit on Ubuntu safari-map

olee

comment created time in 15 days

push eventAzure-Samples/brewdis

Arjun Attam

commit sha d51fcb766b4e49364d6ccf9eb099468e0eceaa40

use macos

view details

push time in 15 days

startedmicrosoft/playwright

started time in 15 days

push eventAzure-Samples/brewdis

Arjun Attam

commit sha 11410ed54da167f09339498910152c3857d8fc57

use windows

view details

push time in 15 days

issue closedmicrosoft/playwright

[Question] Should Playwright kill the browser process on TimeoutError?

const {chromium} = require('playwright');

(async () => {
    const browser = await chromium.launch();
    const context = await browser.newContext();
    context.setDefaultTimeout(3000);
    const page = await context.newPage();
    await page.goto('https://bing.com');
    await page.click('#fictional-selector');
    await browser.close();
})();

Currently, this script will fail with a UnhandledPromiseRejectionWarning: TimeoutError. That will lead to the Node and browser processes being stuck and unusable. I could add catch the error, but who uses try-catch anyway?

Even if I do add a try-catch, I would be tempted to wrap the whole snippet and not handle the catch.

const {chromium} = require('playwright');

(async () => {
    try {
        const browser = await chromium.launch();
        const context = await browser.newContext();
        context.setDefaultTimeout(3000);
        const page = await context.newPage();
        await page.goto('https://bing.com');
        await page.click('#fictional-selector');
        await browser.close();
    } catch (e) {
        //
    }
})();

But this seems to hang indefinitely, and does not print anything to stdout.

I could focus the try-catch to the line I know fails, but is it fair to assume that I know which line will fail? Doing so will fix the hanging processes.

const {chromium} = require('playwright');

(async () => {
    const browser = await chromium.launch();
    const context = await browser.newContext();
    context.setDefaultTimeout(3000);
    const page = await context.newPage();
    await page.goto('https://bing.com');
    try {
        await page.click('#fictional-selector');
    } catch (e) {
        //
    }
    await browser.close();
})();

I know I'm taking many shortcuts, but only trying to represent what I see in the wild :)

closed time in 15 days

arjun27

issue commentmicrosoft/playwright

[Question] Should Playwright kill the browser process on TimeoutError?

Yes, you're right. The question was to check if we can have a better dev experience than Ctrl+C. But I agree that there's value in leaving the headful browser usable. It is also common for the test runner to handle such cases and count it as a failed test. I'm closing this issue as we are doing what we can in the context of playwright.

arjun27

comment created time in 15 days

push eventAzure-Samples/brewdis

Arjun Attam

commit sha f1eaaaa7d10a08649b5365eca1e707670bfe3ea6

comment out waitForFunction

view details

push time in 15 days

issue openedmicrosoft/playwright

[BUG] [FF, WK] TypeError: messages is not iterable

Context:

  • Playwright Version: 1.1.0-next.1593199815258 (current ToT)
  • Operating System: Mac
  • Node version: 13.12
  • Browser: Firefox and WebKit

Code Snippet

Help us help you! Put down a short code snippet that illustrates your bug and that we can run and debug locally. For example:

const {firefox} = require('playwright');

(async() => {
  const browser = await firefox.launch();
  const page = await browser.newPage();
  await page.goto('https://brewdis-spring-cloud-retail.azuremicroservices.io/');
  await page.fill('[placeholder=Search]', 'ipa');
  await page.keyboard.press('Enter');
  await page.waitForSelector('mat-card-title');
  
  // Wait for images to be loaded
  const imgs = await page.$$('mat-card img');
  console.log(imgs.length); // 50
  await page.waitForFunction((imgs) => {
    return imgs.map(i => i.complete).every(Boolean);
  }, imgs);

  await page.screenshot({ path: 'pw-search.png'});
  await browser.close();
})();

I have a page.waitForFunction to wait for images to load before taking a screenshot. This works on Chromium, but failing on Webkit and Firefox with the following error from within _streamLogs in dom.ts

(node:75457) UnhandledPromiseRejectionWarning: TypeError: messages is not iterable
    at InjectedScriptPollHandler._streamLogs (/Users/arjun/brewdis/brewdis-ui/node_modules/playwright/lib/dom.js:605:35)
(node:75457) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)

created time in 15 days

issue commentmicrosoft/playwright

[BUG] Dangling context menu after right-click on WebKit headful Windows

That's right. Sorry for the confusion.

arjun27

comment created time in 16 days

issue closedmicrosoft/playwright

How to extract the text content of web page.

i have used the function page.content(); but it returns the raw html . is there any function which return only the text content display on the web page.

closed time in 16 days

kunal0810

issue commentmicrosoft/playwright

How to extract the text content of web page.

what version of Playwright are you using? These APIs are available since 1.1

kunal0810

comment created time in 16 days

issue commentmicrosoft/playwright

How to extract the text content of web page.

Would this one of these work for you? These methods fetch inner text/text content from a selector, and I'm passing body to get the text inside the <body> tag

await page.innerText('body');

await page.textContent('body');
kunal0810

comment created time in 16 days

issue closedmicrosoft/playwright

wants to extract the all link from webppage.

I have to implemented this function.

var hyperlinks = await page.evaluate( () => { return document.links; });

web page has about 287 links but this function is returning a array of 287 element but every 287 element is empty not able to href of those element.

closed time in 16 days

kunal0810

issue commentmicrosoft/playwright

wants to extract the all link from webppage.

@kunal0810 - The result of the function inside page.evaluate needs to be serializable – so that it can be transported over the wire from the browser to Nodejs. You can modify your snippet to fix that:

const hrefs = await page.evaluate(() => Array.from(document.links).map(item => item.href));
kunal0810

comment created time in 16 days

issue commentmicrosoft/playwright

[Question] How do I debug within a browser instance?

Hi @saviomuc! To use the debugger keyword, you will need to run the script with an additional flag for node, like this:

node --inspect-brk script.js

Alternatively, you can setup Node debugging in VS Code (with a launch.json file). If you are on VS Code 1.40+, you can run the "Create JavaScript Debug Terminal" command to launch a new debug-friendly terminal. Any node scripts launched from this terminal will respect the debugger keyword. This last feature depends on the new JS debugger - see how to enable.

Assigning myself to add this to our docs. Thanks for the suggestion!

saviomuc

comment created time in 16 days

issue commentmicrosoft/playwright

[BUG] Webkit clears on page.type – Chromium/Firefox don't

@yury-s: I meant to share the snippet with page.type (not fill), which is behaving differently on webkit. Apologies for the confusion!

arjun27

comment created time in 16 days

create barnchAzure-Samples/brewdis

branch : playwright-next

created branch time in 16 days

issue commentmicrosoft/playwright

[Question] Is it possible to run Playwright tests on real mobile device browsers?

@Filipoliko - thank you for sharing. Can you elaborate on which bugs are not discoverable via emulation? Examples will really help!

Cosmin-Gramada

comment created time in 16 days

issue openedmicrosoft/playwright

[Question] Should Playwright kill the browser process on TimeoutError?

const {chromium} = require('playwright');

(async () => {
    const browser = await chromium.launch();
    const context = await browser.newContext();
    context.setDefaultTimeout(3000);
    const page = await context.newPage();
    await page.goto('https://bing.com');
    await page.click('#fictional-selector');
    await browser.close();
})();

Currently, this script will fail with a UnhandledPromiseRejectionWarning: TimeoutError. That will lead to the Node and browser processes being stuck and unusable. I could add catch the error, but who uses try-catch anyway?

Even if I do add a try-catch, I would be tempted to wrap the whole snippet and not handle the catch.

const {chromium} = require('playwright');

(async () => {
    try {
        const browser = await chromium.launch();
        const context = await browser.newContext();
        context.setDefaultTimeout(3000);
        const page = await context.newPage();
        await page.goto('https://bing.com');
        await page.click('#fictional-selector');
        await browser.close();
    } catch (e) {
        //
    }
})();

But this seems to hang indefinitely, and does not print anything to stdout.

I could focus the try-catch to the line I know fails, but is it fair to assume that I know which line will fail? Doing so will fix the hanging processes.

const {chromium} = require('playwright');

(async () => {
    const browser = await chromium.launch();
    const context = await browser.newContext();
    context.setDefaultTimeout(3000);
    const page = await context.newPage();
    await page.goto('https://bing.com');
    try {
        await page.click('#fictional-selector');
    } catch (e) {
        //
    }
    await browser.close();
})();

I know I'm taking many shortcuts, but only trying to represent what I see in the wild :)

created time in 17 days

issue openedmicrosoft/playwright

[BUG] [Firefox] Error: document has been mutated since the result was returned

Context:

  • Playwright Version: 1.1.1 and next
  • Operating System: Windows and Mac
  • Browser: Firefox

Code Snippet

const {firefox} = require('playwright');

(async () => {
    const browser = await firefox.launch();
    const context = await browser.newContext();
    const page = await context.newPage();
    await page.goto('file:///Users/arjun/pw-examples/testing-page.html');

    await page.evaluate(() => {
        const xpaths = [
            "//*[@id='hover-link']", "//*[@id='delayed-create-container']"
        ]
        for (const xpath of xpaths) {
            var elements = document.evaluate(xpath, document, null, XPathResult.ANY_TYPE, null);
            if (elements) {
                var thisElement = elements.iterateNext();
                while (thisElement) {
                    thisElement.style.visibility='hidden';
                    allDescendants(thisElement);
                    thisElement = elements.iterateNext();
                }
            }
        }
        function allDescendants (node) {
            for (var i = 0; i < node.childNodes.length; i++) {
                var child = node.childNodes[i];
                if (child && child.style) {
                    child.style.visibility='hidden';
                    allDescendants(child);
                }
            }
        }
    });

    await page.screenshot({path: 'test.png'});
    await browser.close();
})();

Works on Chromium and Webkit. Fails on Firefox.

(node:8972) UnhandledPromiseRejectionWarning: Error: Evaluation failed: XPathResult.iterateNext: The document has been mutated since the result was returned
@__playwright_evaluation_script__1:12:44
callFunction@__playwright_evaluation_script__0:302:28
@__playwright_evaluation_script__2:1:44

    at checkException (/Users/arjun/pw-examples/node_modules/playwright/lib/firefox/ffExecutionContext.js:86:15)
    at FFExecutionContext.evaluateWithArguments (/Users/arjun/pw-examples/node_modules/playwright/lib/firefox/ffExecutionContext.js:49:9)
    at async FrameManager.waitForSignalsCreatedBy (/Users/arjun/pw-examples/node_modules/playwright/lib/frames.js:82:24)
    at async FrameExecutionContext.evaluateInternal (/Users/arjun/pw-examples/node_modules/playwright/lib/dom.js:40:16)
    at async /Users/arjun/pw-examples/right.js:9:5
  -- ASYNC --
    at Frame.evaluate (/Users/arjun/pw-examples/node_modules/playwright/lib/helper.js:67:23)
    at /Users/arjun/pw-examples/node_modules/playwright/lib/page.js:261:61
    at Page._attributeToPage (/Users/arjun/pw-examples/node_modules/playwright/lib/page.js:332:20)
    at Page.evaluate (/Users/arjun/pw-examples/node_modules/playwright/lib/page.js:261:21)
    at Page.evaluate (/Users/arjun/pw-examples/node_modules/playwright/lib/helper.js:68:31)
    at /Users/arjun/pw-examples/right.js:9:16

<details><summary>HTML source</summary>

<!DOCTYPE html>

<style>
	.d-none {
		visibility: hidden;
	}

	.pad {
		margin: 4px;
	}

	a:hover {
	  color: red;
	}
</style>

<html>
    <head>
        <title>Testing Page</title>
    </head>
    <body id="body">
		<div>
			<input type="text" id="input-box" class="pad" value="Hello, world!"></input>
		</div>
		<div>
			<a id="hover-link" href="https://www.bing.com" class="pad">bing.com</a>
		</div>
		<div>
			<button id="change-text-button" class="pad" onmousedown="rightClickCapture()" onclick="change()">Change Text</button>
			<span id="change-text-label">Original Text</span>
		</div>
    	<div id="delayed-create-container">
        	<button id="delayed-create-button" class="pad" onclick="create()">Create After 1 Second</button>
        </div>
        <div>
	        <button id="delayed-reveal-button" class="pad" onclick="reveal()">Reveal After 1 Second</button>
			<span id="delayed-reveal-label" class="d-none">Hello, there!</span>
		</div>
    </body>
</html>

<script>
	const sleep = (milliseconds) => {
		return new Promise(resolve => setTimeout(resolve, milliseconds))
	}

	function change() {
		document.getElementById("change-text-label").innerHTML = "Altered Text";
	}

	function rightClickCapture() {
		var rightclick;
	    var e = window.event;
	    if (e.which) rightclick = (e.which == 3);
	    else if (e.button) rightclick = (e.button == 2);
	    if (rightclick) {
	    	document.getElementById("change-text-label").innerHTML = "Right-click Text";
	    }
	}
	
	function create() {
		sleep(1000).then(() => {
			var el = document.createElement("span");
			el.innerHTML = 'Hello, there!';
			el.id = 'delayed-create-label';
			document.getElementById("delayed-create-container").appendChild(el);
		})
	}
	
	function reveal() {
		sleep(1000).then(() => {
			document.getElementById("delayed-reveal-label").classList.remove("d-none");
		})
	}
</script>

</details>

created time in 17 days

issue openedmicrosoft/playwright

[BUG] Webkit clears on page.type – Chromium/Firefox don't

Context:

  • Playwright Version: 1.1.1 and next
  • Operating System: Windows and Mac
  • Browser: Webkit

Code Snippet

const {webkit} = require('playwright');

(async () => {
    const browser = await webkit.launch({headless: false, slowMo: 100});
    const context = await browser.newContext();
    const page = await context.newPage();
    await page.setContent(`<input type="text" id="example" value="default" />`);
    await page.fill('#example', 'text');
    await browser.close();
})();

Browser behaviors for input value:

  • Chromium: textdefault
  • Firefox: textdefault
  • Webkit: text

Should they behave consistently? Which is right?

created time in 17 days

issue openedmicrosoft/playwright

[BUG] [Firefox] Screenshot fails due to permission error on file:// URL

Context:

  • Playwright Version: 1.1.1 and next
  • Operating System: Windows and Mac
  • Browser: Firefox (works on other 2)

Code Snippet

const {firefox} = require('playwright');

(async () => {
    const browser = await firefox.launch();
    const context = await browser.newContext();
    const page = await context.newPage();
    await page.goto("file:///Users/arjun/pw-examples/testing-page.html");
    await page.click('#hover-link'); // goes to bing.com
    await page.goBack();
    await page.screenshot({path: 'test.png'});
    await browser.close();
})();

This is the error stack trace:

(node:8519) UnhandledPromiseRejectionWarning: Error: Evaluation failed: Permission denied to access property "scrollX" on cross-origin object
@__playwright_evaluation_script__34:1:11
callFunction@__playwright_evaluation_script__33:302:28
@__playwright_evaluation_script__36:1:44

    at checkException (/Users/arjun/pw-examples/node_modules/playwright/lib/firefox/ffExecutionContext.js:86:15)
    at FFExecutionContext.evaluateWithArguments (/Users/arjun/pw-examples/node_modules/playwright/lib/firefox/ffExecutionContext.js:49:9)
    at async FrameManager.waitForSignalsCreatedBy (/Users/arjun/pw-examples/node_modules/playwright/lib/frames.js:82:24)
    at async FrameExecutionContext.evaluateInternal (/Users/arjun/pw-examples/node_modules/playwright/lib/dom.js:40:16)
    at async FFPage.takeScreenshot (/Users/arjun/pw-examples/node_modules/playwright/lib/firefox/ffPage.js:290:34)
    at async Screenshotter._screenshot (/Users/arjun/pw-examples/node_modules/playwright/lib/screenshotter.js:115:24)
    at async /Users/arjun/pw-examples/node_modules/playwright/lib/screenshotter.js:72:20
  -- ASYNC --
    at Page.screenshot (/Users/arjun/pw-examples/node_modules/playwright/lib/helper.js:67:23)
    at /Users/arjun/pw-examples/right.js:10:16

created time in 17 days

issue openedmicrosoft/playwright

[BUG] browser.close does not resolve after right-click on Webkit headful

Context:

  • Playwright Version: 1.1.1
  • Operating System: Tested on Windows and Mac
  • Browser: Webkit

Code Snippet

Similar to #2699. When running Webkit in headful mode, the browser.close does not resolve because it leaves a dangling context menu. Pressing escape or clicking on a menu item resolves browser.close.

const {webkit} = require('playwright');

(async () => {
    const browser = await webkit.launch({headless: false});
    const context = await browser.newContext();
    const page = await context.newPage();
    await page.goto("https://www.bing.com");
    await page.click("//*[@id='b_logo']", {button: 'right'});
    await browser.close();
})();```

created time in 17 days

issue openedmicrosoft/playwright

[BUG] Dangling context menu after right-click on WebKit headless Windows

Context:

  • Playwright Version: 1.1.1
  • Operating System: Windows (works on Mac)
  • Node version: 12.18
  • Browser: Webkit

Code Snippet

const {webkit} = require('playwright');

(async () => {
    const browser = await webkit.launch({headless: false});
    const context = await browser.newContext();
    const page = await context.newPage();
    await page.goto("https://www.bing.com");
    await page.click("//*[@id='b_logo']", {button: 'right'});
    await browser.close();
})();

Since the execution is headless, no UI should be shown

Screen Shot 2020-06-24 at 7 13 07 PM

created time in 17 days

issue openedmicrosoft/playwright

[BUG] Chromium headless on Windows does not launch without --disable-gpu

I'm seeing a few internal MS customers run into issues with launching Chromium headless on Windows. These users are able to use Chromium with the --disable-gpu flag. Should we make this a default for Windows? What would be the downside?

Related chromium upstream issue: https://bugs.chromium.org/p/chromium/issues/detail?id=737678

created time in 17 days

issue commentmicrosoft/playwright

[Question] Ci/Cd using AWS Codebuild/Codepipeline

Yes, it would. I believe that would also make it simpler to maintain over time, since the Playwright version will only have to be updated in your NPM dependencies.

We were just talking about this situation in our team today, and I do believe there is merit in ensuring the build env has Playwright browsers pre-installed. Let's approach this incrementally, starting with publishing the Docker image (#1482) so that it can be used directly. We can then follow up with improvements, like adding browsers to the Docker env. We want to make this easy for users, and I really appreciate this discussion :)

burritoIand

comment created time in 17 days

issue commentmicrosoft/playwright

What is the proper way of handling tests with more that one tab?

await Promise.all will ensure that there are no races between the action that opens the new tab and getting the event. Is there something I'm missing?

shishkin17

comment created time in 17 days

issue commentmicrosoft/playwright

What is the proper way of handling tests with more that one tab?

Since you know when the new page will be opened, I would recommend the following pattern. This will help your code be more linear. Let me know if this works better for you.

const [newPage] = await Promise.all([
  context.waitForEvent('page'),
  // Replace this with submitting the form
  page.evaluate(() => window.open('https://google.com', '_blank'))
])
console.log(await newPage.title());
// More steps with newPage
shishkin17

comment created time in 17 days

PR opened microsoft/playwright

docs: improve snippets for console logs

to prevent issues like #2648

+20 -7

0 comment

1 changed file

pr created time in 18 days

create barncharjun27/playwright-1

branch : console-logs

created branch time in 18 days

issue commentmicrosoft/playwright

[Question] Ci/Cd using AWS Codebuild/Codepipeline

Thanks @burritoIand - and apologies that I wasn't clear earlier. This is a typical setup that we see for Docker:

  1. The docker file sets up the OS level dependencies (using apt-get)
  2. The docker file also sets the user to non-root (called pwuser in this case) for Chrome sandboxing
  3. Inside the docker container, the repo is cloned/mounted
  4. The repo has a package.json that defines playwright as a dependency (or dev dependency), with a specific version
  5. Running npm i for the repo installs the right version of playwright, and the relevant browser builds

Note that only steps 1 and 2 are in the dockerfile. Does this match with how you're thinking? I want to make this simpler to use - and perhaps we could communicate this differently in our docs. Let me know

burritoIand

comment created time in 18 days

more