aerokube / selenoid

Selenium Hub successor running browsers within containers. Scalable, immutable, self hosted Selenium-Grid on any platform with single binary.
https://aerokube.com/selenoid/latest/
Apache License 2.0
2.57k stars 322 forks source link

Always_open_pdf_externally and -start-maximized not working #1132

Closed mhbm closed 7 months ago

mhbm commented 3 years ago

I uses this

 $args = array(
                "--no-proxy-server",
                "--no-default-browser-check",
                "--no-first-run",
                "--disable-boot-animation",
                "--disable-default-apps",
                "--disable-translate",
                "--disable-web-security",
                "--allow-running-insecure-content",
                "--ignore-ssl-errors=yes",
                "--ignore-certificate-errors",
                "--start-maximized",
                "--disable-blink-features=AutomationControlled"
            );

            $chromeOptions->addArguments($args);

 $prefs = array(
                "plugins.plugins_list" => ["enabled" => false, "name" => "Chrome PDF Viewer"],
                "plugins.always_open_pdf_externally" => true,
                "download.default_directory" => $this->selenoid_download_folder,
                "profile.content_settings.exceptions.automatic_downloads.*.setting" => 1,
                "profile.default_content_settings.popups" => 0,
                "profile.default_content_setting_values.geolocation" => 2,
                "profile.password_manager_enabled" => false,
                "download.prompt_for_download" => false,
                "download.directory_upgrade" => true,
                "safebrowsing.enabled" => false,
                "credentials_enable_service" => false,
            );

$chromeOptions->setExperimentalOption(
                'prefs', 
                $prefs
            );

$capabilities = DesiredCapabilities::chrome();
            $capabilities->setCapability(ChromeOptions::CAPABILITY_W3C, $chromeOptions);
            $capabilities->setCapability("enableVNC", true);

            $this->driver = RemoteWebDriver::create($host, $capabilities, 0, 0);

            $this->driver->get($url);

This happens in the selenoid-ui

image

The browser didn't maximized the page, but I put in the args. This is the first problem.

The second problem is this:

image

The pdf file opened in PDF Viewer, but in the configuration of selenium is to open externally.

The Selenoid version is:

You are using Selenoid 1.10.4!

I used the documentation, but all changes that I made didn't fix theses bugs.

vania-pooh commented 3 years ago

@mhbm I would check Chromedriver logs in respective log file being saved by Selenoid when enableLogs capability is set. Probably Chromedriver is implicitly passing more arguments which prevent Chrome from using your feature. Also in our browser images there is no external PDF viewer installed.

mhbm commented 3 years ago

@vania-pooh Thank you for answer my question. The second problem ( about the pdf preview ) is about that the file is not download automatically. I read the documention of selenoid and I used the instructions , but didn’t work . I need that the download happens automatically.

About the first problem ( that the window is not maximum size ) I follow the documentation too and didn’t work too .

vania-pooh commented 3 years ago

@mhbm Selenium has a dedicated maximize call that should work.

mhbm commented 3 years ago

@vania-pooh I will try to use this . and about the problem with automatically download ?

mhbm commented 3 years ago

@vania-pooh I used the enableLogs capability.

And the images is : image

I will search about this, but the logs didn't show anything

vania-pooh commented 3 years ago

@mhbm you are probably going to another Selenium server, not Selenoid.

mhbm commented 3 years ago

@vania-pooh thanks for the answer.

####
# ATENTION:
# Replace all occurences of sandbox with your project's name
####

# v2 syntax
version: '3'
services:

  selenoid:
    container_name: selenoid
    network_mode: bridge
    build: .
    volumes:
      - ".:/etc/selenoid"
      - "/var/run/docker.sock:/var/run/docker.sock"
      - "./video:/opt/selenoid/video"
      - "./logs:/opt/selenoid/logs"
    environment:
      - OVERRIDE_VIDEO_OUTPUT_DIR=./video
    command: ["-conf", "/etc/selenoid/browsers.json", "-video-output-dir", "/opt/selenoid/video", "-log-output-dir", "/opt/selenoid/logs", "-limit", "30", "-timeout", "5m"]
    ports:
      - "4445:4444"

  chrome:
    container_name: chrome
    network_mode: bridge
    image: selenoid/vnc_chrome:86.0
    depends_on:
      - selenoid
    links: 
      - selenoid
    ports:
      - "4446:4444"

  ggr:
    container_name: ggr
    network_mode: bridge
    volumes:
      - "./grid-router/:/etc/grid-router"
    image: aerokube/ggr:latest-release
    depends_on:
      - selenoid
    links: 
      - selenoid
    ports:
      - "4444:4444"

  ggr-ui:
    container_name: ggr-ui
    network_mode: bridge
    volumes:
      - "./grid-router/:/etc/grid-router"
    image: aerokube/ggr-ui:latest-release
    depends_on:
      - selenoid
      - ggr
    links:
      - selenoid
    ports:
      - "8888:8888"

  selenoid-ui:
    container_name: selenoid-ui
    network_mode: bridge
    image: aerokube/selenoid-ui:latest-release
    depends_on:
      - selenoid
      - ggr
      - ggr-ui
    links: 
      - ggr-ui
    command: ["--selenoid-uri", "http://ggr-ui:8888"]
    ports:
      - "8080:8080"
This is my docker-compose.yml

What is the correct selenoid?

vania-pooh commented 3 years ago

@mhbm should be on port 4445 according to your file.

mhbm commented 3 years ago

@vania-pooh If I use this port, the result is this:

image

And I change everything about the automatically download of PDF, but when I check the configuration, the option is always false: image

Could you help me, @vania-pooh ?

vania-pooh commented 3 years ago

@mhbm then there is no log file saved.

mhbm commented 3 years ago

@vania-pooh and about the problems ? I can't resolve yet

vania-pooh commented 3 years ago

@mhbm I don't exactly know how this PDF flag is working. Probably your app is missing Content-Disposition header for the download to happen automatically.

github-actions[bot] commented 8 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.