Webdriver via Firefox Portable (python)

2,738 views
Skip to first unread message

Zvonimir Mostarac

unread,
Mar 28, 2012, 4:53:37 PM3/28/12
to seleniu...@googlegroups.com
Hello, 

I'm new to selenium, so sorry if this question is foolish but I could not find answer, and most of examples are for java (I want to work with python).
Is there a way to run webriver via python interface on firefox portable?
I'm looking for a way to define firefox binary location and to run it with with wine (I use linux), also will webdriver be able to run firefox with it's default profile?
Not the one defined by webdriver default's.

Thanks.

David

unread,
Jul 19, 2012, 9:02:33 PM7/19/12
to seleniu...@googlegroups.com
I'd like to know as well. From some other threads, sorry don't have the links, it seems to say you have to include firefox binary in the system/python path.

Looking at the docs for Python bindings, it seems to indicate you could supply path to binary when you instantiate the driver but it doesn't seem to work for me or it's not fully implemented yet or my syntax is incorrect. Here's the error output from python shell:

>>> from selenium import webdriver 
>>> d = webdriver.Firefox(firefox_binary='/Applications/Firefox12/Firefox.app/Contents/MacOS/firefox-bin')

Traceback (most recent call last): File "", line 1, in File "/Library/Python/2.6/site-packages/selenium/webdriver/firefox/webdriver.py", line 51, in __init__ self.binary, timeout), File "/Library/Python/2.6/site-packages/selenium/webdriver/firefox/extension_connection.py", line 47, in __init__ self.binary.launch_browser(self.profile) AttributeError: 'str' object has no attribute 'launch_browser'

Luke Inman-Semerau

unread,
Jul 19, 2012, 11:03:08 PM7/19/12
to seleniu...@googlegroups.com
firefox_binary is another python object you have to pass, not a string.

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To post to this group, send email to seleniu...@googlegroups.com.
To unsubscribe from this group, send email to selenium-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/selenium-users/-/0sr6x5saHPUJ.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

David

unread,
Jul 20, 2012, 3:11:03 PM7/20/12
to seleniu...@googlegroups.com
Thanks Luke, got it to work now. As an FYI to other users, this is how I got it to work:

from selenium import webdriver
ffbin = webdriver.firefox.firefox_binary.FirefoxBinary('/Applications/Firefox12/Firefox.app/Contents/MacOS/firefox-bin')
d = webdriver.Firefox(firefox_binary=ffbin)

Another thing to note regarding the FF portable question in this thread. I recall having trouble trying to use FF portable on Windows with WebDriver (in Java, never got to try with Python until now via this thread, haven't tested with Python for Windows yet). So you may or may not have issues like I did. However, FF portable for Mac with WebDriver (Java again, and just tested with Python) does work.

For Mac, I used FF 3.6 portable (can google for it) along with non portable FF 12. Though I put FF 12 under a separate folder than the default install location in my Apps directory.
Reply all
Reply to author
Forward
0 new messages