Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[🐛 Bug]: Chrome Standalone Docker Image cannot download file #1918

Closed
AsukaWhite opened this issue Aug 20, 2023 · 5 comments
Closed

[🐛 Bug]: Chrome Standalone Docker Image cannot download file #1918

AsukaWhite opened this issue Aug 20, 2023 · 5 comments

Comments

@AsukaWhite
Copy link

What happened?

when using the docker image, cannot find the filename.crdownload in anyplace.
I'm using python,and selenium is a module for function not distribution test.
Need help!!!
Code for selenium initilization:

prefs = {"download.default_directory": download_path}
chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument('--headless')
chrome_options.add_argument('--no-sandbox')
chrome_options.add_argument('--disable-dev-shm-usage')
chrome_options.add_experimental_option('prefs', prefs)
driver = webdriver.Chrome(options=chrome_options)

Command used to start Selenium Grid with Docker

FROM selenium/standalone-chrome

WORKDIR /code
COPY ./requirements.txt /code/requirements.txt
USER root

RUN apt-get update -y
RUN apt-get install python3-pip -y
RUN pip install --upgrade pip
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt

RUN useradd -m -u 1000 user
USER user

ENV HOME=/home/user \
	PATH=/home/user/.local/bin:$PATH

WORKDIR $HOME/app

COPY --chown=user . $HOME/app
RUN python3 --version
CMD ["python3", "app.py"]

Relevant log output

No error log

Operating System

Ubuntu

Docker Selenium version (tag)

selenium/standalone-chrome

@github-actions
Copy link

@AsukaWhite, thank you for creating this issue. We will troubleshoot it as soon as we can.


Info for maintainers

Triage this issue by using labels.

If information is missing, add a helpful comment and then I-issue-template label.

If the issue is a question, add the I-question label.

If the issue is valid but there is no time to troubleshoot it, consider adding the help wanted label.

If the issue requires changes or fixes from an external project (e.g., ChromeDriver, GeckoDriver, MSEdgeDriver, W3C), add the applicable G-* label, and it will provide the correct link and auto-close the issue.

After troubleshooting the issue, please add the R-awaiting answer label.

Thank you!

@stephenarifin-payscore
Copy link

stephenarifin-payscore commented Aug 22, 2023

Also facing this issue

Adding a little more info in ruby:

I use setup headless_for_download like this:

def setup_headless_for_download
    bridge = page.driver.browser.send(:bridge)

    path = "/session/#{bridge.session_id}/chromium/send_command"
    path = ENV['SELENIUM_URL'] + path if ENV['SELENIUM_URL'].present?

    bridge.http.call(
      :post,
      path,
      cmd: 'Page.setDownloadBehavior',
      params: {
        behavior: 'allow',
        downloadPath: PATH
      }
    )
  end

And my github actions workflow is set up like this:

run_system_tests:
    runs-on: ubuntu-latest
    services:
      postgres:
        image: postgres:latest
        ports:
          - 5432:5432
      selenium:
        image: selenium/standalone-chrome:latest
        ports:
          - 4444:4444
        volumes:
          - ${{ github.workspace }}:${{ github.workspace }}

@diemol
Copy link
Member

diemol commented Aug 23, 2023

There are a few things involved here:

If you have more questions, please use the links below.

@github-actions
Copy link

💬 Please ask questions at:

Copy link

github-actions bot commented Dec 9, 2023

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked and limited conversation to collaborators Dec 9, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants