FF20 upgrade broke RF

624 views
Skip to first unread message

Curtis Matthews

unread,
Apr 16, 2013, 10:10:16 AM4/16/13
to robotframe...@googlegroups.com
Firefox did an auto-upgrade yesterday to FF20. After the upgrade, the "Open Browser" keyword in Selenium2Library can no longer be used to open a Firefox window. It gives an error: "Type Error: environment can only contain strings"

This happens whether or not I use the argument "browser=firefox" or just leave it blank to let Firefox be selected by default. Chrome & IE work fine...and I also verified it is not a Webdriver shortcoming - I can drive Firefox through Webdriver without RF just fine.

I've tried everything to figure out what's going on here, including uninstalling and reinstalling everything. Anyone have some idea what's going on here or what I should try to fix this problem?

Markus Bernhardt

unread,
Apr 16, 2013, 10:19:47 AM4/16/13
to matthews...@gmail.com, robotframe...@googlegroups.com
You have to upgrade selenium to 2.32.0. From the changelog:

v2.32.0
=======

WebDriver:
This release supports Firefox verions: 10esr, 17esr, 19, 20


--
You received this message because you are subscribed to the Google Groups "robotframework-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-u...@googlegroups.com.
To post to this group, send email to robotframe...@googlegroups.com.
Visit this group at http://groups.google.com/group/robotframework-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Teppo Testaaja

unread,
Apr 17, 2013, 9:44:39 AM4/17/13
to robotframe...@googlegroups.com

Actually for me this ("environment can only contain strings" - problem) started happening right after I upgraded Selenium to the 2.32.0 version. When I reverted back to using Selenium 2.31.0 version, Firefox testing started to run normally. I was using Firefox 19.02 (but not sure if the browser had automatically upgraded itself to 20.0)

Br,
Teppo

Curtis Matthews

unread,
Apr 17, 2013, 2:00:46 PM4/17/13
to robotframe...@googlegroups.com
I have logged this as an issue for the Selenium2Library devs. I have managed to conclude that the problem only occurs when Open Browser is invoked locally, as it would be in:

Open Browser | http://www.url.com/
Open Browser | http://www.url.com/ | browser=firefox

The framework I created is switchable between local execution & remote execution (SauceLabs). There is no problem at all in FF20 or Selenium 2.32.0 if you do this:

Open Browser | http://www.url.com/ | remote_url=${sauceLabsHubURL} | desired_capabilities=browser:firefox,version=20.0.1

So my best guess is the Open Browser keyword is passing something to Selenium that it used to be OK with, but not anymore...

Tatu Aalto

unread,
Apr 18, 2013, 5:18:47 AM4/18/13
to robotframe...@googlegroups.com
Ugh

Ran in to same problem (before reading this thread) and did do some digging. Basically this could be webdriver problem. If I do this (basically same this as Open Browser keyword does):
from selenium import webdriver
profile_dir = 'C:\\tmp\\ff_profile'
profile = webdriver.FirefoxProfile(profile_dir)
browser = webdriver.Firefox(firefox_profile=profile)

Then I get:
Traceback (most recent call last):
  File "C:\tmp\webdriver.py", line 7, in <module>
    browser = webdriver.Firefox(firefox_profile=profile)
  File "C:\Python27\lib\site-packages\selenium\webdriver\firefox\webdriver.py", line 61, in __init__
    self.binary, timeout),
  File "C:\Python27\lib\site-packages\selenium\webdriver\firefox\extension_connection.py", line 47, in __init__
    self.binary.launch_browser(self.profile)
  File "C:\Python27\lib\site-packages\selenium\webdriver\firefox\firefox_binary.py", line 50, in launch_browser
    self._start_from_profile_path(self.profile.path)
  File "C:\Python27\lib\site-packages\selenium\webdriver\firefox\firefox_binary.py", line 73, in _start_from_profile_path
    env=self._firefox_env).communicate()
  File "C:\Python27\lib\subprocess.py", line 679, in __init__
    errread, errwrite)
  File "C:\Python27\lib\subprocess.py", line 893, in _execute_child
    startupinfo)
TypeError: environment can only contain strings

Where C:\\tmp\\ff_profile is just a copy of my Firefox 20.0.1 profile.

As a workaround downgrading to selenium 2.31.0 removes the problem and there similar issues reported in the selenium bug tracker [1], [2]. So best would be to use selenium 2.31.0 with Firefox 20 and wait for new selenium release.

-Tatu
[1] http://code.google.com/p/selenium/issues/detail?id=5508&q=TypeError%3A%20environment%20can%20only%20contain%20strings&colspec=ID%20Stars%20Type%20Status%20Priority%20Milestone%20Owner%20Summary
[2] http://code.google.com/p/selenium/issues/detail?id=5512&q=TypeError%3A%20environment%20can%20only%20contain%20strings&colspec=ID%20Stars%20Type%20Status%20Priority%20Milestone%20Owner%20Summary

Asko Soukka

unread,
Apr 18, 2013, 6:12:08 AM4/18/13
to robotframe...@googlegroups.com
Hi,

just had to dig into this.

When you use a custom firefox-profile, the generated profile directory path is sent as unicode string for webdriver and causes the seen error.

To fix this, if the profile path is or gets converted to unicode, it must be back to bytestring, probably somewhere here: http://code.google.com/p/selenium/source/browse/py/selenium/webdriver/firefox/firefox_profile.py#116

Currently, monkeypatching selenium-package would get you pass this error.

-Asko

Asko Soukka

unread,
Apr 18, 2013, 6:23:28 AM4/18/13
to robotframe...@googlegroups.com

Curtis Matthews

unread,
Apr 19, 2013, 3:19:08 PM4/19/13
to robotframe...@googlegroups.com
Awesome. So, what would the "monkey patch" route entail here? I haven't messed around with encoding much in Python...

Asko Soukka

unread,
Apr 21, 2013, 12:14:39 AM4/21/13
to robotframe...@googlegroups.com
perjantai, 19. huhtikuuta 2013 22.19.08 UTC+3 Curtis Matthews kirjoitti:
> Awesome. So, what would the "monkey patch" route entail here? I haven't messed around with encoding much in Python...

I guess, the simplest way is just to update the file in local installation. So, locate your:

    http://code.google.com/p/selenium/source/browse/py/selenium/webdriver/firefox/firefox_profile.py#120

and replace

     self.profile_dir = newprof

with

     self.profile_dir = str(newprof)

That will break if the profile path contains non-ascii characters. The real fix could be something like if type(newprof) == unicode: self.profile_dir = newprof.encode('utf-8')

-Asko

Curtis Matthews

unread,
Apr 22, 2013, 9:31:59 AM4/22/13
to robotframe...@googlegroups.com
self.profile_dir = str(newprof) works like a charm. Thanks a lot Asko!

-Curtis


On Tuesday, April 16, 2013 10:10:16 AM UTC-4, Curtis Matthews wrote:
Reply all
Reply to author
Forward
0 new messages