Skip to content

Commit

Permalink
Allow for unit test to work with v4.17.2 and prior versions
Browse files Browse the repository at this point in the history
  • Loading branch information
emanlove committed Jan 23, 2024
1 parent 0facfed commit 43b43e0
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions utest/test/keywords/test_firefox_profile_parsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,15 @@ def test_single_method(self):

def _parse_result(self, result):
to_str = ""
if "key1" in result._desired_preferences:
to_str = f"{to_str} key1 {result._desired_preferences['key1']}"
if "key2" in result._desired_preferences:
to_str = f"{to_str} key2 {result._desired_preferences['key2']}"
# handle change made in selenium 4.17.2 with Firefox profiles
if hasattr(result, _desired_preferences):
# selenium v4.17.2+
pref_attrib = '_desired_preferences'
else:
# selenium v 4.16.0 and prior
pref_attrib = 'default_preferences'
if "key1" in getattr(result, pref_attrib):
to_str = f"{to_str} key1 {getattr(result, pref_attrib)['key1']}"
if "key2" in getattr(result, pref_attrib):
to_str = f"{to_str} key2 {getattr(result, pref_attrib)['key2']}"
self.results.append(to_str)

0 comments on commit 43b43e0

Please sign in to comment.