Setting up Selenium on Cygwin
Jump to navigation
Jump to search
Using Selenium with Cygwin
Errors
Path issue - script cannot find the browser to invoke it.
See notes:
http://chibimagic.wordpress.com/2011/07/28/selenium-server-2-0-on-mac-os-xwindows-with-custom-firefox-path/
Run something like:
strace -f -o /tmp/log.strace java -jar selenium-server-standalone-2.5.0.jar
grep -i stat /tmp/log.strace
to track down file / path problems...
> > Got all the required bits installed on my workstation (I think) - with > Python 2.6. > > Got the following error when I ran the script I captured yesterday. > > $ ./tst_02.py > E > ====================================================================== > ERROR: test_tst02 (__main__.Tst02) > ---------------------------------------------------------------------- > Traceback (most recent call last): > File "./tst_02.py", line 12, in setUp > self.driver = webdriver.Firefox() > File > "/usr/lib/python2.6/site-packages/selenium-2.5.0-py2.6.egg/selenium/we > bd river/firefox/webdriver.py", line 46, in __init__ > self.binary, timeout), > File > "/usr/lib/python2.6/site-packages/selenium-2.5.0-py2.6.egg/selenium/we > bd river/firefox/extension_connection.py", line 46, in __init__ > self.binary.launch_browser(self.profile) > File > "/usr/lib/python2.6/site-packages/selenium-2.5.0-py2.6.egg/selenium/we > bd river/firefox/firefox_binary.py", line 43, in launch_browser > self._start_from_profile_path(self.profile.path) > File > "/usr/lib/python2.6/site-packages/selenium-2.5.0-py2.6.egg/selenium/we > bd river/firefox/firefox_binary.py", line 64, in > _start_from_profile_path > Popen([self._start_cmd, "-silent"], stdout=PIPE, stderr=PIPE).wait() > File "/usr/lib/python2.6/subprocess.py", line 633, in __init__ > errread, errwrite) > File "/usr/lib/python2.6/subprocess.py", line 1139, in _execute_child > raise child_exception > AttributeError: 'NoneType' object has no attribute 'rfind' > > ---------------------------------------------------------------------- > Ran 1 test in 1.337s > > FAILED (errors=1) > > > Standalone server is running in the background: > > $ javaw -jar selenium-server-standalone-2.5.0.jar & > > xxx 5780 2216 1 11:45:01 > /cygdrive/c/Progra~1/Java/jdk1.6.0_23/bin/javaw > > > -----Original Message----- > Sent: Tuesday, 30 August, 2011 3:43 PM > Subject: http://code.google.com/p/selenium/wiki/PythonBindings > > http://code.google.com/p/selenium/wiki/PythonBindings > > The python bindings for Selenium 2 are now available. The bindings > include the full functionality of Selenium 1 and 2 (WebDriver). The > package currently supports the Remote, Firefox, Chrome and IE > protocols natively. > > > note : Currently Selenium only supports Python 2.6 and Python 2.7 > > Am using Python 2.6 on my workstation... > > > > If using selenium 1, before attempting to run a test, be sure to > download the Selenium Server jar file, and run it via > > > java -jar selenium-server-standalone.jar > > I take it this would suffice: > > $ javaw -jar selenium-server-standalone-2.5.0.jar & > > > in your terminal/cmd prompt, before attempting to run a test. > > Selenium > 2 however, does not require the jar file. > > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > > > $ pip install selenium > Requirement already satisfied (use --upgrade to upgrade): selenium in > /usr/lib/python2.6/site-packages/selenium-2.5.0-py2.6.egg > Requirement already satisfied (use --upgrade to upgrade): > rdflib==3.1.0 in /usr/lib/python2.6/site-packages (from selenium) > Cleaning up... > > I installed from the Selenium-2.5.0 I downloaded yesterday. > > > > $ ./tst.py > Traceback (most recent call last): > File "./tst.py", line 6, in <module> > driver = webdriver.Firefox() > File > "/usr/lib/python2.6/site-packages/selenium-2.5.0-py2.6.egg/selenium/we > bd river/firefox/webdriver.py", line 46, in __init__ > self.binary, timeout), > File > "/usr/lib/python2.6/site-packages/selenium-2.5.0-py2.6.egg/selenium/we > bd river/firefox/extension_connection.py", line 46, in __init__ > self.binary.launch_browser(self.profile) > File > "/usr/lib/python2.6/site-packages/selenium-2.5.0-py2.6.egg/selenium/we > bd river/firefox/firefox_binary.py", line 43, in launch_browser > self._start_from_profile_path(self.profile.path) > File > "/usr/lib/python2.6/site-packages/selenium-2.5.0-py2.6.egg/selenium/we > bd river/firefox/firefox_binary.py", line 64, in > _start_from_profile_path > Popen([self._start_cmd, "-silent"], stdout=PIPE, stderr=PIPE).wait() > File "/usr/lib/python2.6/subprocess.py", line 633, in __init__ > errread, errwrite) > File "/usr/lib/python2.6/subprocess.py", line 1139, in _execute_child > raise child_exception > AttributeError: 'NoneType' object has no attribute 'rfind' > > xxx@xxx /d/arch/Selenium > > > $ cat tst.py > #!/usr/bin/env python > > from selenium import webdriver > > driver = webdriver.Firefox() > > > Looks like it cannot find Firefox... > > > http://code.google.com/p/selenium/wiki/PythonBindings > Add Firefox directory to Windows PATH in Windows Environment Variables and this will then be added to Cygwin PATH