Hello, I've been trying to install Selenium which could be utilized for my website, but there have been some complications.
These were the steps that i've taken for installation:
- Activate virtual environment (
source senv/bin/activate
) - Download Selenium (
pip install selenium
) - Download PyVirtualDisplay for a display server (
pip install pyvirtualdisplay
) - Download and unpack latest chrome driver for linux (using wget's HTTP request)
- Add chrome driver's path to environmental variable $PATH (
export PATH=$PATH:<path>
) - Testing: in Python shell, open a display server (
Display(visible=0, size=(x, y)).start()
) - Testing: in Python shell, select a webdriver for Selenium, specifying the absolute path (
driver = webdriver.Chrome(executable_path="/home/MTonskins/<some_other_folder>/<my_app>/chromedriver")
Execution of step 7 prompted an error after waiting quite a while:
selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: crashed
(Driver info: chromedriver=2.34.522913 (36222509aa6e819815938cbf2709b4849735537c),platform=Linux 4.4.0-101-generic x86_64
I'm not able to fully understand what could the problem be. Outside of virtual environment, Selenium, PyVirtualDisplay and Firefox driver are installed and are working by default, but there are some limitations, that's the reason why i want to run my script inside virtual environment.
So, what could the problem be? Am i doing something wrong? Also, i'm also wondering which web driver would be the fastest one that works in pythonanywhere servers? (Since, as i know, PhantomJS headless browser is not practical in web applications).
Thank you!