playwright

Running Playwright in Azure Function

廉价感情. 提交于 2021-02-08 07:26:12
问题 I'm trying to run a simple Azure Function that would enter page and generate a PDF depending on what is visible in a browser. I created a NodeJS 12 Azure Function with Linux Consumption Plan (B1). I set PLAYWRIGHT_BROWSERS_PATH to 0 . Function code looks like this: const { chromium } = require("playwright-chromium"); const baseUrl = "http://someurl"; const targetPage = "/action/"; module.exports = async function (context, req) { const browser = await chromium.launch(); const page = await

Running Playwright in Azure Function

Deadly 提交于 2021-02-08 07:23:25
问题 I'm trying to run a simple Azure Function that would enter page and generate a PDF depending on what is visible in a browser. I created a NodeJS 12 Azure Function with Linux Consumption Plan (B1). I set PLAYWRIGHT_BROWSERS_PATH to 0 . Function code looks like this: const { chromium } = require("playwright-chromium"); const baseUrl = "http://someurl"; const targetPage = "/action/"; module.exports = async function (context, req) { const browser = await chromium.launch(); const page = await

Using Playwright for Python, how do I select (or find) an element?

走远了吗. 提交于 2021-01-28 05:54:05
问题 I'm trying to learn the Python version of Playwright. See here I would like to learn how to locate an element, so that I can do things with it. Like printing the inner HTML, clicking on it and such. The example below loads a page and prints the HTML from playwright import sync_playwright with sync_playwright() as p: browser = p.chromium.launch(headless=False) page = browser.newPage() page.goto('http://whatsmyuseragent.org/') print(page.innerHTML("*")) browser.close() This page contains an

How to catch a download with playwright?

☆樱花仙子☆ 提交于 2020-04-17 17:53:49
问题 I'm trying to download a file from a website using Playwright. The button that triggers the download does some js and then the download starts. Clicking the button using the .click function triggers a download but it shows an error: Failed - Download error . I've tried using the devtools protocol Page.setDownloadBehavior, but this doesn't seem to do anything. const playwright = require("playwright"); const { /*chromium,*/ devices } = require("playwright"); const iPhone = devices["iPad (gen 7)