Giter Site home page Giter Site logo

Comments (13)

LucianoGanga avatar LucianoGanga commented on May 28, 2024

Well! I finally got some time to do this.

I made a few changes in the way the screenshots are taken, because the Chrome DevTools Protocol deprecated some methods.

So I finally came with this example:
https://github.com/LucianoGanga/simple-headless-chrome/blob/master/examples/screenCapture.js

Where you can take screenshots in headless mode again, and besides that it receives a parameter "fullPage" (to take full page screens, as you can imagine) or "selector", where you get a screenshot of the area of a selector you pass.

I hope this helps you with the issue, and please let me know.

Everything is in v4.3.0 of this module.

I'll close the issue, but please feel free to reopen it if something doesn't work :)

Cheers!
Lucho

from simple-headless-chrome.

mmarsella avatar mmarsella commented on May 28, 2024

Hey Luciano,

Thanks so much for getting back to me. I tried running my example with the newest version and also tried replicating your example. Both of which threw this error:

ERROR! { Error: Invalid parameters (fitWindow: boolean value expected)

I don't believe I can re-open issues that you have closed.

from simple-headless-chrome.

LucianoGanga avatar LucianoGanga commented on May 28, 2024

from simple-headless-chrome.

mmarsella avatar mmarsella commented on May 28, 2024

Yup!

from simple-headless-chrome.

mmarsella avatar mmarsella commented on May 28, 2024

Also related to this issue - while I was trying to debug this problem, I tried passing the flag:

'--window-size=1280,1696' to the browser instance, but it didn't seem to change anything while running headless (in regards to window visibility).

const browser = new HeadlessChrome({
  headless: true,
  chrome: {
    flags: [
      '--window-size=1280,1696'
    ]
  }
})

from simple-headless-chrome.

LucianoGanga avatar LucianoGanga commented on May 28, 2024

from simple-headless-chrome.

mmarsella avatar mmarsella commented on May 28, 2024

I am using chrome version 59.0.3071.115.

I'll take a look at Browser.js in the meantime - thanks for your time Luciano

from simple-headless-chrome.

LucianoGanga avatar LucianoGanga commented on May 28, 2024

Hi! I can't test with that chrome version as I have the v60.0.3112.90

About the issue:

ERROR! { Error: Invalid parameters (fitWindow: boolean value expected)

When I released v4.3.0 I removed the property fitWindow because it's deprecated in the last version of the protocol, but when I ran the tests on Travis CI, with the Stable version of Chrome, it gave me that error. So I fixed adding back that property in the options, and the tests passed.

If I were you, I'd double check that the installed version of the module is 4.3.1, just in case.

About the size. Did you have some luck?

Tip: You can always run the code with the env variable DEBUG="HeadlessChrome:*" to see the module logs.

Cheers!
Lucho

from simple-headless-chrome.

fusionx1 avatar fusionx1 commented on May 28, 2024

Im getting the same error. Im using chrome Version 60.0.3112.90

ERROR! { Error: Invalid parameters (fitWindow: boolean value expected)
   at /Users/fusionx1/Projects/pantheon/automation/node_modules/chrome-remote-interface/lib/chrome.js:90:30
   at Chrome.handleMessage (/Users/fusionx1/Projects/pantheon/automation/node_modules/chrome-remote-interface/lib/chrome.js:289:13)
   at WebSocket.<anonymous> (/Users/fusionx1/Projects/pantheon/automation/node_modules/chrome-remote-interface/lib/chrome.js:266:27)
   at emitTwo (events.js:106:13)
   at WebSocket.emit (events.js:194:7)
   at Receiver._receiver.onmessage (/Users/fusionx1/Projects/pantheon/automation/node_modules/ws/lib/WebSocket.js:143:54)
   at Receiver.dataMessage (/Users/fusionx1/Projects/pantheon/automation/node_modules/ws/lib/Receiver.js:385:14)
   at extension.decompress (/Users/fusionx1/Projects/pantheon/automation/node_modules/ws/lib/Receiver.js:354:40)
   at _inflate.flush (/Users/fusionx1/Projects/pantheon/automation/node_modules/ws/lib/PerMessageDeflate.js:279:12)
   at afterWrite (_stream_writable.js:383:3)
   at onwrite (_stream_writable.js:374:7)
   at afterTransform (_stream_transform.js:79:3)
   at TransformState.afterTransform (_stream_transform.js:54:12)
   at Zlib.callback (zlib.js:625:5)
 response: 
  { code: -32602,
    message: 'Invalid parameters',
    data: 'fitWindow: boolean value expected' } }```

from simple-headless-chrome.

LucianoGanga avatar LucianoGanga commented on May 28, 2024

@fusionx1 , can you submit an example?

Make sure you have the latest version installed (and install it through NPM)

Thanks!
Lucho

from simple-headless-chrome.

timo-klarshift avatar timo-klarshift commented on May 28, 2024

I am running: Chromium 60.0.3112.113 and getting the same error about fitWindow

from simple-headless-chrome.

fusionx1 avatar fusionx1 commented on May 28, 2024

from simple-headless-chrome.

LucianoGanga avatar LucianoGanga commented on May 28, 2024

Done! fitWindow problem fixed in 4.3.9!

I could finally reproduce the issue and fix it. Thanks @fusionx1 for your help on Skype the other day :)
And sorry for taking so long to fix it.

Cheers!
Lucoh

from simple-headless-chrome.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.