Difference between revisions of "Getting Started with Selenium"

From PeformIQ Upgrade
Jump to navigation Jump to search
Line 22: Line 22:
==Setting Up==
==Setting Up==


<pre>
* [[Setting up Selenium on Cygwin]]
Probably a path issue...
 
http://chibimagic.wordpress.com/2011/07/28/selenium-server-2-0-on-mac-os-xwindows-with-custom-firefox-path/
 
I usually 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.
>
> $ ./eparcel_02.py
> E
> ======================================================================
> ERROR: test_eparcel02 (__main__.Eparcel02)
> ----------------------------------------------------------------------
> Traceback (most recent call last):
>  File "./eparcel_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
>
> Maybe I need to start with a simpler example to make sure all the
> pre-requisites are working OK.
>
 
 
>
> -----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.
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>
> Huh?  Is it spawned out of Python?
>
>
> xxx@xxx/d/arch/Selenium
> $ 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.
>
>
>
> xxx@xxx /d/arch/Selenium
> $ !$
> ./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
>
 
</pre>


[[Category:Selenium]]
[[Category:Selenium]]
[[Category:Python]]
[[Category:Python]]

Revision as of 09:02, 13 November 2011