Skip to content
This repository has been archived by the owner on Nov 24, 2018. It is now read-only.

add chromeFlags, chromePath and --headless as default #192

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

gorangajic
Copy link

@gorangajic gorangajic commented Aug 7, 2017

@adieuadieu
Copy link
Collaborator

adieuadieu commented Aug 7, 2017

@gorangajic Thank you for this PR. Would you mind adding chromePath while you're at it? See #184

@adieuadieu adieuadieu added this to the v1.3 milestone Aug 7, 2017
@@ -44,6 +44,7 @@ export default class Chromeless<T extends any> implements Promise<T> {
closeTab: true,
...options.cdp,
},
chromeFlags: ['--headless'],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not ['--headless', ...(options.chromeFlags||[])] ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what when someone does not want --headless mode, then it's not possible to override flags? Anyway I am open to that change because I will never want to run chrome without headless flag :)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm.. We cannot force the use of --headless. We can set it as a default as @gorangajic has done, but a user needs to be able to omit it. There are valid use cases where you'd want to see what's happening in a window. Another approach would be to add a headless: true parameter to the constructor options which defaults to true, then add the headless flag based on that. In some ways I prefer this as its more explicit and the behavior is clearer (rather than, if you want to disable the headless flag, knowing to pass an empty array of chromeFlags.) @joelgriffith what do you think?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could go the route of passing in a hash of options:

{ headless: true } => '--headless'
{ remoteDebuggingPort: 1234 } => '--remote-debugging-port=1234'
{ headless: false, disableGpu: true } => '--disable-gpu'

This way you can splat new params into place, and still have defaults like headless

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remoteDebuggingPort is already behind cdp options and chrome is using port provided there so no need to duplicate that logic here. Whatever you guys want, I am open to changes

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also like the object hash option

@gorangajic gorangajic changed the title add chromeFlags options and add --headless flag as default add chromeFlags, chromePath and --headless as default Aug 7, 2017
@schickling
Copy link
Owner

@adieuadieu you had the most experience with the Chrome part. Please go ahead!

@adieuadieu adieuadieu modified the milestones: v1.4, v1.3 Aug 29, 2017
@kawikadkekahuna
Copy link

Will chromeFlags support a --no-sandbox mode? It seems like ArchLinux uses SUID instead of Namespace, which is preventing chrome from launching different instances with unique debugging ports. This would be extremely useful to run tests using chromeless in parallel locally.

@jborden13
Copy link

@gorangajic do you know if this will allow proxies set in the flags to work on Lambda?

@gorangajic
Copy link
Author

@jborden13 not sure

@adieuadieu adieuadieu removed this from the v1.4 milestone Jan 4, 2018
Fixes schickling#146 pdf only works in headless mode
Fixes schickling#184 Add chromePath and chromeFlags to ChromelessOptions
@codecov-io
Copy link

Codecov Report

Merging #192 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #192   +/-   ##
=======================================
  Coverage   38.03%   38.03%           
=======================================
  Files           7        7           
  Lines         844      844           
  Branches      116      116           
=======================================
  Hits          321      321           
  Misses        523      523
Impacted Files Coverage Δ
src/api.ts 47.71% <ø> (ø) ⬆️
src/chrome/local.ts 54.38% <ø> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update fcdc8dc...deb8d40. Read the comment docs.

@IAMtheIAM
Copy link

What is waiting for this to be merged?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
10 participants