Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to disable the headless browser to load images? #1

Closed
wizenith opened this issue Jun 3, 2017 · 2 comments
Closed

how to disable the headless browser to load images? #1

wizenith opened this issue Jun 3, 2017 · 2 comments

Comments

@wizenith
Copy link

wizenith commented Jun 3, 2017

First of all, thanks for creating this great tool for manipulating the browser api easily, and sorry i am just a newbie, and i wonder what should I do to disable the headless browser to load images ? and is it possible to wrap that sort of relevant event as a function ?
I've researched the document https://chromedevtools.github.io/devtools-protocol/tot/Page/ , and i have no cue where is the right direction may meet my demand. I hope there's a way to solve it. and I'll appreciate if this could be supported. thank you

@dotneet
Copy link
Contributor

dotneet commented Jun 4, 2017

Hi winzenith

You can use blockUrls() to solve your problem.

const Chromy = require('chromy')

let chromy = new Chromy({visible: true})
chromy.chain()
      .blockUrls(['*.png', '*.jpg', '*.jpeg', '*.gif'])
      .goto('https://example.com/')
      .sleep(10000)
      .end()
      .then(_ => chromy.close())
      .catch(_ => chromy.close())

@wizenith wizenith closed this as completed Jun 5, 2017
@wizenith
Copy link
Author

wizenith commented Jun 5, 2017

Hi dotneet

It works and supported very well, thank you so much for your help 👍 : )

dotneet pushed a commit that referenced this issue Jun 29, 2017
fix babel configuration for node v7,v8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants