2

I need python version below 3 to make it work with Selenium web-driver library & Robot Framework. However, another standalone program on my pc needs python 3.5 & websocket-client.

I installed python 2.7, pip and all needed libraries. Path variable points to the python 2.7. After this my robot framework was working smoothly with Selenium2Library.

Then I installed python 3.5. Did not change path variable. Installed websocket-client package going inside the python 3.5 folder where pip.exe was located. Then hardcoded my other program to look for python.exe from 3.5 folder.

Now the other program runs fine but the selenium gives me error. Surprisingly, open and close browser keywords working, but others are not! Pls advise.

Robot Selenium Error Log Screenshot

WebDriverException: Message: disconnected: unable to connect to renderer
  (Session info: chrome=62.0.3202.94)
  (Driver info: chromedriver=2.31.488763 (092de99f48a300323ecf8c2a4e2e7cab51de5ba8),platform=Windows NT 10.0.10586 x86_64)
Patz
  • 294
  • 4
  • 18
  • I assume the "Robot Framework" is the issue here? Because I have no issue with selenium in 3+ – SuperStew Nov 20 '17 at 18:02
  • Is there a reason you did not use a virtual environment like virtualenv or virtualenvwrapper? – kmcodes Nov 20 '17 at 18:04
  • You can do 2 ways: 1. Use virtualnv. 2. Just change names of python.exe in one version. For example, python3, and simply call `python3 program2`. – Angelicos Phosphoros Nov 20 '17 at 18:31
  • @SuperStew : The Selenium2Library for Robot Framework is the culprit here. Other libraries for Robot and selenium for other platforms can work with later versions. – Patz Nov 20 '17 at 18:54
  • @angelicos : will try both the suggestions and see. – Patz Nov 20 '17 at 18:56
  • @kmcodes: will try that – Patz Nov 20 '17 at 18:56
  • Use `virtualenv` – galfisher Nov 20 '17 at 21:48
  • Can you confirm that on both versions of Python you're running the same Robot Framework, SeleniumLibrary and Selenium modules? In addition have you tried updating your chrome driver to the latest version (2.33)? – A. Kootstra Nov 21 '17 at 20:11
  • Python 2.7 I need for Robot Framework. Python 3.5 I am using for another standalone program running on my PC only. – Patz Nov 28 '17 at 14:39

1 Answers1

4

There's quite a few ways to achieve this.

1) There's the Python Launcher for windows, which will allow you to use Python 3 and Python 2 simultaneously. You just gotta use the launcher like this:

py -2 myscript.py py -3 myscript.py

2) You can install both versions on their own, and rename both Python.exe and Pythonw.exe in their individual python installation directories. You usually want to rename them to something like Python27.exe / Pythonw27.exe for Python 2.7, and Python35.exe / Pythonw35.exe for Python 3.5. Now all you have to do is use them like this:

python27 myscript.py python35 myscript.py

3) Using virtualenv by specifying the python executable when you create your new virtual environment. You can find a thread with detailed answers on this particular solution here

No matter what, you might wanna look at the latest version of Selenium2Library, which has been renamed to SeleniumLibrary and features Python 3.x support and many improvements.

Verv
  • 2,385
  • 2
  • 23
  • 37