1

when I using chrome headless like this:

chrome_driver_service = Service(ChromeDriverManager(chrome_type=ChromeType.GOOGLE).install())
        chrome_options = Options()
        chrome_options.add_argument("--headless")
        chrome_options.add_argument('--no-sandbox')
        chrome_options.add_argument("--remote-debugging-port=9230")
        driver = webdriver.Chrome(service=chrome_driver_service, options=chrome_options)

shows error:

Arguments: (SessionNotCreatedException('session not created\nfrom disconnected: unable to connect to renderer\n  (Session info: headless chrome=96.0.4664.45)', None, ['#0 0x55ce538f8ee3 <unknown>', '#1 0x55ce533c6608 <unknown>', '#2 0x55ce533b0195 <unknown>', '#3 0x55ce533c7a02 <unknown>', '#4 0x55ce534213ea <unknown>', '#5 0x55ce5341a163 <unknown>', '#6 0x55ce533efbfc <unknown>', '#7 0x55ce533f0c05 <unknown>', '#8 0x55ce5392abaa <unknown>', '#9 0x55ce53940651 <unknown>', '#10 0x55ce5392bb05 <unknown>', '#11 0x55ce53941a68 <unknown>', '#12 0x55ce5392005f <unknown>', '#13 0x55ce5395c818 <unknown>', '#14 0x55ce5395c998 <unknown>', '#15 0x55ce53977eed <unknown>', '#16 0x7f1b6a6f1ea7 <unknown>', '']),)

this is the kubernetes pod /etc/hosts file:

root@pydolphin-service-659668ffb4-6jqsr:~/pydolphin# cat /etc/hosts
# Kubernetes-managed hosts file.
127.0.0.1       localhost
::1     localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
fe00::0 ip6-mcastprefix
fe00::1 ip6-allnodes
fe00::2 ip6-allrouters
10.97.196.201   pydolphin-service-659668ffb4-6jqsr

where is going wrong? what should I do to fix this problem? BTW, this is my Dockerfile that how to install the chromedriver:

# install google chrome
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -
RUN sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list'
RUN apt-get -y update
RUN apt-get install -y google-chrome-stable

# install chromedriver
RUN apt-get install -yqq unzip
RUN wget -O /tmp/chromedriver.zip http://chromedriver.storage.googleapis.com/`curl -sS chromedriver.storage.googleapis.com/LATEST_RELEASE`/chromedriver_linux64.zip
RUN unzip /tmp/chromedriver.zip chromedriver -d /usr/local/bin/

# set display port to avoid crash
ENV DISPLAY=:99
Dolphin
  • 29,069
  • 61
  • 260
  • 539

0 Answers0