0

As the title, the following is not working on the digitalocean ubuntu droplet, but works on my local computer. All the software are the same.

It is just hanging there.

import os
from selenium import webdriver
from pyvirtualdisplay import Display

display = Display(visible=0, size=(800, 600))
display.start()
driver = webdriver.Chrome()
driver.get("http://www.google.com")
print driver.page_source.encode('utf-8')
driver.quit()
display.stop()

Can anybody give me some clue? Thanks a lot.I have searching all around and could not find any helpful information.

Roy
  • 75
  • 2
  • 9
  • Hey! Could you provide anymore details about what you've installed, etc... Do you have the `xvfb` package installed? You'll need that for the headless "display." – andrewsomething Feb 23 '15 at 21:39
  • Thanks a lot. I thought I have installed it on the server. But it did not. Now works like a charm. – Roy Feb 25 '15 at 04:28

2 Answers2

0

Installing Selenium and Chrome

apt install -y libxss1 libappindicator1 libindicator7
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
dpkg -i google-chrome*.deb
apt install -y -f
pip3 install selenium

Check Google Chrome Version

google-chrome-stable -version

Install compatable chromedriver from https://chromedriver.chromium.org/downloads

wget https://chromedriver.storage.googleapis.com/77.0.3865.40/chromedriver_linux64.zip

apt install -y unzip
unzip chromedriver_linux64.zip
rm chromedriver_linux64.zip
chmod +x chromedriver
mv -f chromedriver /usr/local/bin/chromedriver

apt install -y xvfb
pip3 install pyvirtualdisplay

Then run your file!

Amit Ghosh
  • 1,500
  • 13
  • 18
  • That's just an installation guideline. Are you sure that this is the problem? – csabinho Oct 20 '19 at 23:53
  • Yes. The program looks fine. So the only problem lies in installation which I was stuck for the last 3 days haha. Must be some program that is not installed. – Amit Ghosh Oct 22 '19 at 05:52
0

If you droplet is below the required RAM amount, selenium will not work.