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

Set deviceScaleFactor doesn't work #367

@rodacato

Description

@rodacato

I'm trying to get retina display screenshots using deviceScaleFactorwithout luck so far.

I have an AWS lambda as describing it here, basically using the remote functionality, something like this:

async function run() {
  let chromeless;
  try {
    chromeless = new Chromeless({
      remote: {
        endpointUrl: 'https://xxxxxxx.execute-api.us-west-2.amazonaws.com/dev/',
        apiKey: 'xxxxxxxxxxxxxxxxxxxx'
      },
      viewport: {
        width: 1280,
        height: 5000,
        scale: 2,
        deviceScaleFactor: 2,
      }
    })

    const screenshot = chromeless
      .setViewport({ deviceScaleFactor: 2 })
      .goto(options.url)
      .wait(5000)

    let fullPage = await screenshot.screenshot()

    const response = [{ id: 'Full page', url: fullPage }]
    for (let selector of options.selectors) {
      let url = await screenshot.wait(selector.selector).screenshot(selector.selector)
      selector.url = url
      response.push(selector);
    }

    console.log(JSON.stringify(response))
  } catch(err) {
    console.error(err)
  } finally {
    await chromeless.end()
  }
}

run().catch(console.error.bind(console))

On the above script, I tried to set the option for the remote server and set it in the viewport, none of them have any change in the output, so, going further I looked into the source code for the right option but I found it is hardcoded to 1 here.

so I'm wondering if is it possible to get screenshots with high DPI from chromeless?

Thank you

Activity

samratjp

samratjp commented on Jan 3, 2018

@samratjp

I'm having the same issue. Anyone else have a workaround to this - short of forking and hardcoding the change?

Thanks!

adieuadieu

adieuadieu commented on Jan 4, 2018

@adieuadieu
Collaborator

Would be grateful for a PR that un-hardcode's it. 😊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @samratjp@rodacato@adieuadieu

        Issue actions

          Set deviceScaleFactor doesn't work · Issue #367 · schickling/chromeless