Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python bindings for Firefox should correct permissions for copied profile dir #1466

Closed
datakurre opened this issue Jan 13, 2016 · 4 comments
Closed

Comments

@datakurre
Copy link

I'm using Selenium Python bindings with RobotFramework Selenium2Libary, which provides its own Firefox profile directory skeleton. If I have Selenium2Library installed as a read only package, a read only profile directory from Selenium2Library gets copied and later a permission exception is raised when Selenium bindings try to add additional user.js into that directory:

IOError: [Errno 13] Permission denied: '/var/folders/b1/mld_r9wj1jbfwf2jcfl_d61sc6kdnb/T/tmpBjsYCj/webdriver-py-profilecopy/user.js'

To fix the issue, I have needed to make the copy of profile dir writable after copy:

--- a/py/selenium/webdriver/firefox/firefox_profile.py  2016-01-13 11:32:42.000000000 +0200
+++ b/py/selenium/webdriver/firefox/firefox_profile.py  2016-01-13 11:32:12.000000000 +0200
@@ -76,6 +76,7 @@
             shutil.copytree(self.profile_dir, newprof,
                             ignore=shutil.ignore_patterns("parent.lock", "lock", ".parentlock"))
             self.profile_dir = newprof
+            os.chmod(self.profile_dir, 0755)
             self._read_existing_userjs(os.path.join(self.profile_dir, "user.js"))
         self.extensionsDir = os.path.join(self.profile_dir, "extensions")
         self.userPrefs = os.path.join(self.profile_dir, "user.js")
@barancev barancev added the C-py label Jan 22, 2016
@joshbruning
Copy link
Contributor

We observe this issue at Google as well, and so have not yet accepted:
7c97c37

@joshbruning
Copy link
Contributor

For what it's worth, the suggested fix did not fix the problem for us, but:

...
self.userPrefs = os.path.join(self.profile_dir, "user.js")
os.chmod(self.userPrefs, 0755)
...

does.

@datakurre
Copy link
Author

@barancev Thank you once more for fixing this. Only now tested the latest versions on the environment with this issue and everything run as expected.

@lmtierney
Copy link
Member

@datakurre thanks for the update!

@lock lock bot locked and limited conversation to collaborators Aug 16, 2019
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

4 participants