Skip to content
This repository was archived by the owner on Nov 29, 2018. It is now read-only.

Cannot create Firefox session with Firefox profile (Python 2.32) #5508

Closed
lukeis opened this issue Mar 4, 2016 · 10 comments
Closed

Cannot create Firefox session with Firefox profile (Python 2.32) #5508

lukeis opened this issue Mar 4, 2016 · 10 comments

Comments

@lukeis
Copy link
Member

lukeis commented Mar 4, 2016

Originally reported on Google Code with ID 5508

What steps will reproduce the problem?
1. Run the following in python:

from selenium import webdriver

profile = webdriver.FirefoxProfile("C:/firefox_profile_dir")
browser = webdriver.Firefox(firefox_profile=profile)

What is the expected output? What do you see instead?
Expect to see a new Firefox browser session started. Instead the following error is
returned:

  File "<stdin>", line 1, in <module>
  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


Looks like the issue stems from the Python 3 support added in 2.32, specifically the
line in firefox_profile.py:

from __future__ import unicode_literals


Selenium version: 2.32
OS: Windows 7 and XP
Browser: Firefox
Browser version: 17

Reported by stevejeffers on 2013-04-16 19:41:34

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

Reading the title back does not make the issue clear. This issue was observed on Python
2.7.2 using the WebDriver 2.32 python bindings.

Reported by stevejeffers on 2013-04-16 19:43:01

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

Reported by barancev on 2013-04-16 22:35:10

  • Labels added: Lang-Python

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

Reported by barancev on 2013-04-16 22:35:23

  • Labels added: Browser-Firefox

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

The issue is here:

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

When there's a custom profile, the resulting profile path "newprof" may be a unicode
string and webdriver accepts only bytestrings.

Decoding "newprof" to bytestring when its unicode would fix this.

Reported by datakurre on 2013-04-18 10:23:00

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

Opened a PR for this issue
https://github.com/SeleniumHQ/selenium/pull/55

Reported by jayakumareee21 on 2013-04-23 16:18:06

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

fixed in f0deca98d8cf65face6c58bc60a2511a51247d52

Reported by david.burns@theautomatedtester.co.uk on 2013-04-30 09:50:56

  • Status changed: Fixed
  • Labels removed: Status-Untriaged

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

I am also facing same issue.Can you pls tell me how to fix this issue.how to get code
from f0deca98d8cf65face6c58bc60a2511a51247d52. 

Reported by attar.reshma on 2013-05-10 20:43:04

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

Issue 5608 has been merged into this issue.

Reported by barancev on 2013-05-18 18:20:04

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

So, What is the solution about the issue step by step?

I don't know how to fix it =(

Please, help me!

Best regards
Eduardo G

Reported by eduardo.guhe on 2014-03-03 23:29:07

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

Reported by luke.semerau on 2015-09-17 18:17:08

  • Labels added: Restrict-AddIssueComment-Commit

@lukeis lukeis closed this as completed Mar 4, 2016
@SeleniumHQ SeleniumHQ locked and limited conversation to collaborators Mar 4, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant