google-chrome-headless

How can I dynamically inject functions to evaluate using Puppeteer?

[亡魂溺海] 提交于 2020-04-27 18:44:35
问题 I am using Puppeteer for headless Chrome. I wish to evaluate a function inside the page that uses parts of other functions, defined dynamically elsewhere. The code below is a minimal example / proof. In reality functionToInject() and otherFunctionToInject() are more complex and require the pages DOM. const browser = await puppeteer.launch(); const page = await browser.newPage(); await page.goto(someURL); var functionToInject = function(){ return 1+1; } var otherFunctionToInject = function

How can I dynamically inject functions to evaluate using Puppeteer?

二次信任 提交于 2020-04-27 18:29:33
问题 I am using Puppeteer for headless Chrome. I wish to evaluate a function inside the page that uses parts of other functions, defined dynamically elsewhere. The code below is a minimal example / proof. In reality functionToInject() and otherFunctionToInject() are more complex and require the pages DOM. const browser = await puppeteer.launch(); const page = await browser.newPage(); await page.goto(someURL); var functionToInject = function(){ return 1+1; } var otherFunctionToInject = function

Why is puppeteer reporting “UnhandledPromiseRejectionWarning: Error: Navigation failed because browser has disconnected!”?

空扰寡人 提交于 2020-03-18 04:17:19
问题 I've got a simple node.js script to capture screenshots of a few web pages. It appears I'm getting tripped up somewhere along the line with my use of async/await, but I can't figure out where. I'm currently using puppeteer v1.11.0. const puppeteer = require('puppeteer'); //a list of sites to screenshot const papers = { nytimes: "https://www.nytimes.com/", wapo: "https://www.washingtonpost.com/" }; //launch puppeteer, do everything in .then() handler puppeteer.launch({devtools:false}).then

Protractor - self-signed ssl headless test e2e don't pass

笑着哭i 提交于 2020-03-05 03:05:59
问题 We have e2e test with Protractor. When I execute the script in my local machine it will pass. Now I have to integrate it with Jenkins system and docker. My webpage re-directs to another login page due to SSO. So I started with an url like this: https://demop-staging-ppd.com and this demop will me send to sso page with another url. When I write script to test if am I on the exact page, it will not pass because this page: I think the problem is we used self ssl certification. this is my conf.js

Protractor - self-signed ssl headless test e2e don't pass

邮差的信 提交于 2020-03-05 03:05:50
问题 We have e2e test with Protractor. When I execute the script in my local machine it will pass. Now I have to integrate it with Jenkins system and docker. My webpage re-directs to another login page due to SSO. So I started with an url like this: https://demop-staging-ppd.com and this demop will me send to sso page with another url. When I write script to test if am I on the exact page, it will not pass because this page: I think the problem is we used self ssl certification. this is my conf.js

ChromeHeadless giving timeout when running GitLab CI pipeline with Docker Centos 7.5 image

别说谁变了你拦得住时间么 提交于 2020-02-03 23:40:33
问题 So I am trying to run Karma tests for an Angular 6 application on a docker image with Centos 7.5 using a pipeline for GitLab CI. The problem is 30 08 2018 07:09:55.222:WARN [launcher]: ChromeHeadless have not captured in 60000 ms, killing. 30 08 2018 07:09:55.244:INFO [launcher]: Trying to start ChromeHeadless again (1/2). 30 08 2018 07:10:55.264:WARN [launcher]: ChromeHeadless have not captured in 60000 ms, killing. 30 08 2018 07:10:55.277:INFO [launcher]: Trying to start ChromeHeadless

org.openqa.selenium.os.OsProcess checkForError and org.apache.commons.exec.ExecuteException: Process exited with an error with Selenium ChromeDriver

﹥>﹥吖頭↗ 提交于 2020-01-30 08:14:26
问题 I'm trying to run soapui in headless mode on linux (works from windows) but when initiating the webdriver portion it seems that chrome doesnt see the driver has started. This is not even the same OS as "OsProcess checkForError : CreateProcess error=193, %1 is not a valid Win32 application" while starting Internet Explorer through Java and Selenium i've tried version 74 and 73 of both chrome and driver. i've tried adding all the selenium jars that come with the server and language bindings to

org.openqa.selenium.os.OsProcess checkForError and org.apache.commons.exec.ExecuteException: Process exited with an error with Selenium ChromeDriver

我是研究僧i 提交于 2020-01-30 08:14:11
问题 I'm trying to run soapui in headless mode on linux (works from windows) but when initiating the webdriver portion it seems that chrome doesnt see the driver has started. This is not even the same OS as "OsProcess checkForError : CreateProcess error=193, %1 is not a valid Win32 application" while starting Internet Explorer through Java and Selenium i've tried version 74 and 73 of both chrome and driver. i've tried adding all the selenium jars that come with the server and language bindings to

How can I disable webRTC local IP leak with puppeteer?

早过忘川 提交于 2020-01-23 17:37:07
问题 I tried: const browser = await puppeteer.launch({args: ['--enable-webrtc-stun-origin=false', '--enforce-webrtc-ip-permission-check=false']}); But this is not working. Next I tried: const targets = await browser.targets(); const backgroundPageTarget = targets.find(target => target.type() === 'background_page'); const backgroundPage = await backgroundPageTarget.page(); await backgroundPage.evaluateevaluateOnNewDocument(() => { chrome.privacy.network.webRTCIPHandlingPolicy.set({ value: "default

Access Denied page with headless Chrome on Linux while headed Chrome works on windows using Selenium through Python

别说谁变了你拦得住时间么 提交于 2020-01-21 19:21:13
问题 I have this code that I'm using on my local machine: from selenium import webdriver chrom_path = r"C:\Users\user\sof\chromedriver_win32\chromedriver.exe" driver = webdriver.Chrome(chrom_path) link = 'https://www.google.com/' driver.get(link) s = driver.page_source print((s.encode("utf-8"))) driver.quit() and this code return page source of this website, however when I go on Linux server centos7 and I use this code: from selenium import webdriver options = webdriver.ChromeOptions() options.add