Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/Selenium2Library/keywords/_browsermanagement.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@

from .keywordgroup import KeywordGroup

try:
unicode
except NameError:
unicode = str

ROOT_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
FIREFOX_PROFILE_DIR = os.path.join(ROOT_DIR, 'resources', 'firefoxprofile')
Expand Down
5 changes: 5 additions & 0 deletions src/Selenium2Library/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
from .browsercache import BrowserCache
from .librarylistener import LibraryListener

try:
unicode
except NameError:
unicode = str


def escape_xpath_value(value):
value = unicode(value)
Expand Down
2 changes: 1 addition & 1 deletion test/unit/keywords/test_browsermanagement.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def test_bad_browser_name(self):
bm._make_browser("fireox")
self.fail("Exception not raised")
except ValueError as e:
self.assertEquals("fireox is not a supported browser.", e.message)
self.assertEquals("fireox is not a supported browser.", "{}".format(e))

def test_create_webdriver(self):
bm = _BrowserManagementWithLoggingStubs()
Expand Down
8 changes: 4 additions & 4 deletions test/unit/locators/test_windowmanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def test_select_with_invalid_prefix(self):
try:
self.assertRaises(ValueError, manager.select, browser, "something=test1")
except ValueError as e:
self.assertEqual(e.message, "Window locator with prefix 'something' is not supported")
self.assertEqual("{}".format(e), "Window locator with prefix 'something' is not supported")

def test_select_with_null_browser(self):
manager = WindowManager()
Expand Down Expand Up @@ -62,7 +62,7 @@ def test_select_by_title_no_match(self):
try:
self.assertRaises(ValueError, manager.select, browser, "title=Title -1")
except ValueError as e:
self.assertEqual(e.message, "Unable to locate window with title 'Title -1'")
self.assertEqual("{}".format(e), "Unable to locate window with title 'Title -1'")

def test_select_by_name(self):
manager = WindowManager()
Expand Down Expand Up @@ -104,7 +104,7 @@ def test_select_by_name_no_match(self):
try:
self.assertRaises(ValueError, manager.select, browser, "name=win-1")
except ValueError as e:
self.assertEqual(e.message, "Unable to locate window with name 'win-1'")
self.assertEqual("{}".format(e), "Unable to locate window with name 'win-1'")

def test_select_by_url(self):
manager = WindowManager()
Expand Down Expand Up @@ -146,7 +146,7 @@ def test_select_by_url_no_match(self):
try:
self.assertRaises(ValueError, manager.select, browser, "url=http://localhost/page-1.html")
except ValueError as e:
self.assertEqual(e.message, "Unable to locate window with URL 'http://localhost/page-1.html'")
self.assertEqual("{}".format(e), "Unable to locate window with URL 'http://localhost/page-1.html'")

def test_select_with_null_locator(self):
manager = WindowManager()
Expand Down
2 changes: 1 addition & 1 deletion test/unit/utils/test_browsercache.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def test_no_current_message(self):
try:
self.assertRaises(RuntimeError, cache.current.anyMember())
except RuntimeError as e:
self.assertEqual(e.message, "No current browser")
self.assertEqual("{}".format(e), "No current browser")

def test_browsers_property(self):
cache = BrowserCache()
Expand Down