SeleniumLibrary icon indicating copy to clipboard operation
SeleniumLibrary copied to clipboard

Can we change the default installation path of selenium2library

Open nadeemsharif opened this issue 15 years ago • 7 comments

Hi, I have python installed at following location : C:\apps\qsi_robot\python-2.7.2 I am using Custom batch file to run robot test cases and my python class path is set to following location: C:\apps\qsi_harness\robot_libs to import all robot libraries.

Is there a way that i can install selenium2 library in C:\apps\qsi_harness\robot_libs folder instead of C:\apps\qsi_robot\python-2.7.2\Lib\site-packages

nadeemsharif avatar Nov 10 '11 18:11 nadeemsharif

Hi nadeemsharif,

This library uses Python's distutils for setup/installation. Here's a brief summary of how it works: http://docs.python.org/install/index.html#how-building-works

Yes, you can instruct it to install to a custom directory. See this: http://docs.python.org/install/index.html#custom-installation

So, first off, you'll need to install from the platform-independent source package. Then I think you'll want to run: python setup.py install --install-lib=C:\apps\qsi_harness\robot_libs

Hope this helps, Ryan

rtomac avatar Nov 11 '11 15:11 rtomac

As per your instructions i installed Selenium2Library at C:\apps\qsi_harness\robot_libs. Now the Selenium2Library keywords are displaying in RIDE but when i run the test case it gives me error message that failed to import library. SyntaxError: 'with' will become a reserved keyword in Python 2.6 (webdriver.py, line 549)

Could you please look into this issue, thanks. bellow is the error message in complete.

Invalid syntax in file 'C:\apps\demo_scripts\test_suites\Selenium_New_Tests\QSIWeb.tsv' in table 'Setting': Importing test library 'Selenium2Library' failed: SyntaxError: 'with' will become a reserved keyword in Python 2.6 (webdriver.py, line 549) PYTHONPATH: ['C:\apps\qsi_harness\robot_libs\Selenium2Library\lib\decorator-3.3.2', 'C:\apps\qsi_harness\robot_libs\Selenium2Library\lib\selenium-2.8.1\py', 'C:\apps\qsi_harness\lib\robot\robotframework-2.6.0.jar\Lib\robot\libraries', 'C:\apps\qsi_harness\lib\robot\Lib', 'C:\apps\qsi_harness\lib\robot\robotframework-2.6.0.jar\Lib', 'classpath', 'pyclasspath/', 'C:\apps\qsi_harness\robot_libs', 'C:\apps\qsi_harness\doc', '.'] CLASSPATH: C:\apps\qsi_harness\lib\robot\robotframework-2.6.0.jar;C:\apps\qsi_harness\bin\qsi_harness_library.jar;C:\apps\qsi_harness\lib\common\activation-1.1.jar;C:\apps\qsi_harness\lib\common\aopalliance-1.0.jar;C:\apps\qsi_harness\lib\common\apache-mime4j-0.6.jar;C:\apps\qsi_harness\lib\common\commons-codec-1.4.jar;C:\apps\qsi_harness\lib\common\commons-io-2.0.1.jar;C:\apps\qsi_harness\lib\common\commons-lang-2.6.jar;C:\apps\qsi_harness\lib\common\commons-logging-1.1.1.jar;C:\apps\qsi_harness\lib\common\commons-net-3.0.1.jar;C:\apps\qsi_harness\lib\common\groovy-all-1.6.7.jar;C:\apps\qsi_harness\lib\common\hsqldb-1.8.0.7.jar;C:\apps\qsi_harness\lib\common\httpclient-4.0.3.jar;C:\apps\qsi_harness\lib\common\httpclient-cache-4.1.1.jar;C:\apps\qsi_harness\lib\common\httpcore-4.0.1.jar;C:\apps\qsi_harness\lib\common\httpmime-4.0.jar;C:\apps\qsi_harness\lib\common\j2ssh-ant-0.2.9.jar;C:\apps\qsi_harness\lib\common\j2ssh-common-0.2.9.jar;C:\apps\qsi_harness\lib\common\j2ssh-core-0.2.9.jar;C:\apps\qsi_harness\lib\common\j2ssh-daemon-0.2.9.jar;C:\apps\qsi_harness\lib\common\java-getopt-1.0.13.jar;C:\apps\qsi_harness\lib\common\javassist-3.6.0.GA.jar;C:\apps\qsi_harness\lib\common\jms-1.1.jar;C:\apps\qsi_harness\lib\common\jmxri-1.2.1.jar;C:\apps\qsi_harness\lib\common\jmxtools-1.2.1.jar;C:\apps\qsi_harness\lib\common\jolokia-client-java-0.95.jar;C:\apps\qsi_harness\lib\common\log4j-1.2.15.jar;C:\apps\qsi_harness\lib\common\mail-1.4.jar;C:\apps\qsi_harness\lib\common\ojdbc-14.jar;C:\apps\qsi_harness\lib\common\ostermillerutils-1.7.0.jar;C:\apps\qsi_harness\lib\common\postgresql-8.4-702.jdbc4.jar;C:\apps\qsi_harness\lib\common\scannotation-1.0.2.jar;C:\apps\qsi_harness\lib\common\sqljdbc4-3.0.jar;C:\apps\qsi_harness\lib\common\xmlunit-1.3.jar;C:\apps\qsi_harness\lib\arcgis\arcobjects-10.0.jar;C:\apps\demo_scripts\test_data\FileChooserDemo.jar;C:\bison\REL_BISON_V12.01.01.00\lib\startup.jar;C:\bison\REL_BISON_V12.01.01.00\lib\workspacemanager.jar;C:\ExtractViewer\lib\extractviewer.jar Traceback (most recent call last): File "C:\apps\qsi_harness\lib\robot\robotframework-2.6.0.jar\Lib\robot\utils\importing$py.class", line 86, in non_dotted_import File "C:\apps\qsi_harness\robot_libs\Selenium2Library__init_.py", line 8, in from keywords import * File "C:\apps\qsi_harness\robot_libs\Selenium2Library\keywords__init__.py", line 3, in from browsermanagement import BrowserManagementKeywords File "C:\apps\qsi_harness\robot_libs\Selenium2Library\keywords_browsermanagement.py", line 4, in from selenium import webdriver File "C:\apps\qsi_harness\robot_libs\Selenium2Library\lib\selenium-2.8.1\py\selenium\webdriver__init.py", line 18, in from firefox.webdriver import WebDriver as Firefox File "C:\apps\qsi_harness\robot_libs\Selenium2Library\lib\selenium-2.8.1\py\selenium\webdriver\firefox\webdriver.py", line 21, in from selenium.webdriver.remote.webdriver import WebDriver as RemoteWebDriver

nadeemsharif avatar Nov 11 '11 16:11 nadeemsharif

From your error message it looks like you're running Python version 2.5. The Selenium Python Bindings require 2.6 or 2.7. See: http://code.google.com/p/selenium/wiki/PythonBindings

I've updated https://github.com/rtomac/robotframework-selenium2library/blob/master/INSTALL.rest to explicitly state that Selenium2Library has the same requirements as the Selenium Python Bindings (since it uses them).

rtomac avatar Nov 11 '11 16:11 rtomac

Thanks for your reply by i am using python 2.7.2 version instead of 2.5 (never installed 2.5 version). Which is installed at following location on my machine: C:\apps\qsi_robot\python-2.7.2 I am using jython-2.5.2 at following location on my machine: C:\apps\qsi_robot\jython-2.5.2 SeleniumLibrary (1) is still working properly in my environment but SeleniumLibary2 is giving me this error message. Could you please help me more to solve this issue.

nadeemsharif avatar Nov 11 '11 20:11 nadeemsharif

Could you please look into above error message and let me know what is the solution because i need to install Selenium2Library.

Your kind help will be highly appreciated.

Thanks.

nadeemsharif avatar Nov 16 '11 22:11 nadeemsharif

Hi nadeemsharif,

Sorry for the slow reply. Jython 2.5 implements the same language features as CPython 2.5, so you are effectively using Python 2.5. Is there a reason you can't run this through the CPython 2.7 installation you have there instead of running it through Jython?

The requirement for Python 2.6/2.7 is a requirement of the Selenium Python libraries, so unfortunately there's nothing I can do about in this wrapper library.

Ryan

rtomac avatar Nov 22 '11 07:11 rtomac

Hi, Ryan:

I have exactly the same problem as was reported. I installed Python 2.7 and Selenium2Library. However, when I'm typing python --version, it returns Python 2.5. Sorry, I did not understand the steps to make it works. Could you please list them in detail? It blocks my work.

Thank you, Vladimir

vladimir100 avatar Jan 02 '12 21:01 vladimir100