Code Monkey home page Code Monkey logo

Comments (9)

abacaj avatar abacaj commented on May 10, 2024 1

Cool, thank you for finding that. I will use the arguments then.

from chrome-headless-browser-docker.

yukinying avatar yukinying commented on May 10, 2024

Would passing "--window-size" to the chromeOptions args field works for you?
See: http://peter.sh/experiments/chromium-command-line-switches/

from chrome-headless-browser-docker.

abacaj avatar abacaj commented on May 10, 2024

Seems to manifest when there is a different version of chrome vs chromedriver. Is that possible in these dockerfiles?

from chrome-headless-browser-docker.

abacaj avatar abacaj commented on May 10, 2024

I tried locally on my machine, using latest stable chrome and chromedriver 2.9 worked correctly when trying to resize window. Maybe resizing relies on xvfb? not sure about the details on this container.

from chrome-headless-browser-docker.

yukinying avatar yukinying commented on May 10, 2024

Do you mind sharing a minimal set of code that could reproduce the issue?

from chrome-headless-browser-docker.

abacaj avatar abacaj commented on May 10, 2024

The code I wrote is in javascript (node)

var webdriver = require("selenium-webdriver");

function getRemoteBrowser() {
    var activePlatform =  {
        "browserName": "chrome",
        "deviceName": "chrome",
        "platformName": "LINUX"
    };
    var browser = new webdriver.Builder()
        .withCapabilities(activePlatform)
        .usingServer('http://192.168.33.10:4444/wd/hub')
        .build();

    var driverWindow = driver.manage().window();

    driverWindow.maximize() // here

    return browser;
}

from chrome-headless-browser-docker.

yukinying avatar yukinying commented on May 10, 2024

According to https://bugs.chromium.org/p/chromedriver/issues/detail?id=1625#c39, headless mode does not support using extension to set the windows size, which seems to be what driver.manage().window().maximize() performed.

I believe that you can just use "--window-size" to set the dimension instead.

from chrome-headless-browser-docker.

alenadasan avatar alenadasan commented on May 10, 2024

"--window-size" not working either.

from chrome-headless-browser-docker.

yukinying avatar yukinying commented on May 10, 2024

Interesting. I am not able to reproduce it:

docker run --init -it --rm --name chrome --shm-size=1024m --cap-add=SYS_ADMIN \
  --entrypoint=/usr/bin/google-chrome-unstable \
  yukinying/chrome-headless-browser \
  --headless --disable-gpu --window-size=200,300 \
  --dump-dom http://howbigismybrowser.com/

And the result contains the correct dimension:

<div id="counter">
  <span class="num">200</span>
  <span id="divider"></span>
  <span class="num">300</span>
</div>

from chrome-headless-browser-docker.

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.