headless-browser

Headless Chrome not detecting css and Background image of the webpage

╄→гoц情女王★ 提交于 2020-03-26 03:56:29
问题 My pdf page don't take background image and any CSS of the page. Can you please tell me how to resolve this issue? const puppeteer = require('puppeteer'); (async () => { const browser = await puppeteer.launch(); const page = await browser.newPage(); await page.goto('https://sigview.sigmoid.io/app/#/signIn', {waitUntil: 'networkidle2', timeout: 0}); await page.waitFor(20000); await page.pdf({path: 'sigview.pdf', format: 'A4'}); await browser.close(); })(); It should take complete web page

Puppeteer Button Press

筅森魡賤 提交于 2020-03-21 11:46:08
问题 According to https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepresskey-options, you can simulate the pressing of a keyboard button with Puppeteer. Here's what I do: // First, click the search button await page.click('#outer-container > nav > span.right > span.search-notification-wrapper > span > form > input[type="text"]'); // Focus on the input field await page.focus('#outer-container > nav > span.right > span.search-notification-wrapper > span > form > input[type="text"

Unable to run Selenium HtmlUnitDriver test (java.net.SocketException)

青春壹個敷衍的年華 提交于 2020-01-24 19:55:06
问题 Im in the process of learning how to use Selenium to automate we browsers and working my way through an online course. Im currently having some problems trying to run a headless browser test using the HtmlUnitDriver I have a simple test that should load a web page and assert the title, code as follows. package com.seleniumsimplified.webdriver; import org.junit.Test; import org.openqa.selenium.WebDriver; import org.openqa.selenium.htmlunit.HtmlUnitDriver; import static org.junit.Assert

How to perform right click with Puppeteer?

房东的猫 提交于 2020-01-24 11:01:31
问题 I'm trying to perform right-click with Puppeteer. I've tried to add the option: await component.click({ button: "right" }) But all I get is a regular click on the component. I followed Puppeteer's API. What am I doing wrong? 回答1: It is correct that you can use elementHandle.click() with the button option set to 'right' to right-click an element: const example = await page.$( '#example' ); await example.click( { button : 'right' }); According to the Official Documentation for elementHandle

How do we pass authentication token in headless chrome in google puppeteer?

流过昼夜 提交于 2020-01-24 05:41:13
问题 I want to pass authentication token(JWT) in puppeteer headers, for the pdf view with headless chrome in my application? We are using react as our front-end UI. And using puppeteer we are able to generate pdf, but the link to pdf we need to authorize using JWT How do we pass the jwt in headers, does puppeteer support Auth token in headers? Please help. Thanks 回答1: To pass additional headers in the request, you can use the function page.setExtraHTTPHeaders. Quote from the docs linked above: The

protractor with any headless browser?

时光毁灭记忆、已成空白 提交于 2020-01-20 05:17:29
问题 I am using protractor and it works when I specify chrome as the browsertype. I am looking for a headless browser sample code, I have looked for phantomJs but I could not run any of them. Is there a working sample available of another headless browser? 回答1: No other headless browser out there besides PhantomJS while the latter is a dead-end with Protractor. You can try docker-selenium or, if you don't like Docker you can do it yourself with ubuntu-headless sample. Both solutions provide Chrome

protractor with any headless browser?

我只是一个虾纸丫 提交于 2020-01-20 05:17:07
问题 I am using protractor and it works when I specify chrome as the browsertype. I am looking for a headless browser sample code, I have looked for phantomJs but I could not run any of them. Is there a working sample available of another headless browser? 回答1: No other headless browser out there besides PhantomJS while the latter is a dead-end with Protractor. You can try docker-selenium or, if you don't like Docker you can do it yourself with ubuntu-headless sample. Both solutions provide Chrome

How to delete existing text from input using Puppeteer?

拟墨画扇 提交于 2020-01-12 06:59:27
问题 I'm trying to test amending text in an editable input which contains the title of the current record - and I want to able to test editing such text, replacing it with something else. I know I can use await page.type('#inputID', 'blah'); to insert "blah" into the textbox (which in my case, having existing text, only appends "blah"), however, I cannot find any page methods1 that allow deleting or replacing existing text. 回答1: You can use page.evaluate to manipulate DOM as you see fit: await

What is this DalekJS error when I try to run a test via PhantomJS?

和自甴很熟 提交于 2020-01-06 07:26:13
问题 Every time I try to run a test using PhantomJS, Dalek gives me this error. However using GoogleChrome the test runs properly. Running tests /Users/user/node_modules/dalekjs/node_modules/dalek-browser-phantomjs/index.js:273 this.spawned.kill('SIGTERM'); ^ TypeError: Cannot read property 'kill' of null at Object.PhantomJSDriver.kill (/Users/user/node_modules/dalekjs/node_modules/dalek-browser-phantomjs/index.js:273:17) at EventEmitter.emit (/Users/user/node_modules/dalekjs/node_modules

Headless browser that support Geolocation

谁都会走 提交于 2020-01-06 04:15:10
问题 Is there any headless browser that support geolocation? I know Phantomjs doesn't support that feature. If no, how programs that uses geolocation (prey project & lockit tight) work? I'm interested in client-side geolocation using WiFi positioning & triangulation. Can any moderator create a tag for WiPS (Wi-Fi Positioning System), if it's appropriate? 回答1: IP Geolocation using IP address done from server-side works for all headless browsers because it can retrieves user IP address instantly on