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] Fixing issues 5508 and 5512. Making sure profile dir path of type str un... #55

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 2 additions & 3 deletions py/selenium/webdriver/firefox/firefox_profile.py
Expand Up @@ -13,7 +13,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from __future__ import with_statement
from __future__ import unicode_literals

import base64
import copy
Expand All @@ -24,11 +23,11 @@
import zipfile

try:
from io import BytesIO
except ImportError:
from cStringIO import StringIO as BytesIO
bytes = str
str = unicode
except ImportError:
from io import BytesIO
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jayakumarc just curious, what's the reasoning behind changing the ordering of the imports?


from xml.dom import minidom
from distutils import dir_util
Expand Down
25 changes: 24 additions & 1 deletion py/test/selenium/webdriver/firefox/ff_profile_tests.py
Expand Up @@ -24,6 +24,12 @@
from io import BytesIO
except ImportError:
from cStringIO import StringIO as BytesIO

try:
unicode
except NameError:
unicode = str

from selenium import webdriver
from selenium.webdriver.common.proxy import Proxy, ProxyType
from selenium.test.selenium.webdriver.common.webserver import SimpleWebServer
Expand Down Expand Up @@ -79,7 +85,7 @@ def test_that_unicode_prefs_are_written_in_the_correct_format(self):
self.driver.quit()

profile = webdriver.FirefoxProfile()
profile.set_preference('sample.preference.2', 'hi there')
profile.set_preference('sample.preference.2', unicode('hi there'))
profile.update_preferences()

assert '"hi there"' == profile.default_preferences["sample.preference.2"]
Expand All @@ -98,6 +104,23 @@ def test_that_unicode_prefs_are_written_in_the_correct_format(self):
break
fp.close()

def test_that_integer_prefs_are_written_in_the_correct_format(self):
# The setup gave us a browser but we dont need it
self.driver.quit()

profile = webdriver.FirefoxProfile()
profile.set_preference("sample.int.preference", 12345)
profile.update_preferences()
assert "12345" == profile.default_preferences["sample.int.preference"]

def test_that_boolean_prefs_are_written_in_the_correct_format(self):
# The setup gave us a browser but we dont need it
self.driver.quit()

profile = webdriver.FirefoxProfile()
profile.set_preference("sample.bool.preference", True)
profile.update_preferences()
assert "true" == profile.default_preferences["sample.bool.preference"]

def test_that_we_delete_the_profile(self):
path = self.driver.firefox_profile.path
Expand Down