File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
py/selenium/webdriver/remote Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change 18
18
"""The WebDriver implementation."""
19
19
20
20
import base64
21
+ import copy
21
22
import warnings
22
23
from contextlib import contextmanager
23
24
@@ -58,13 +59,25 @@ def _make_w3c_caps(caps):
58
59
Filters out capability names that are not in the W3C spec. Spec-compliant
59
60
drivers will reject requests containing unknown capability names.
60
61
62
+ Moves the Firefox profile, if present, from the old location to the new Firefox
63
+ options object.
64
+
61
65
:Args:
62
66
- caps - A dictionary of capabilities requested by the caller.
63
67
"""
68
+ profile = caps .get ('firefox_profile' )
64
69
always_match = {}
65
70
for k , v in caps .iteritems ():
66
71
if k in _W3C_CAPABILITY_NAMES or ':' in k :
67
72
always_match [k ] = v
73
+ if profile :
74
+ moz_opts = always_match .get ('moz:firefoxOptions' , {})
75
+ # If it's already present, assume the caller did that intentionally.
76
+ if 'profile' not in moz_opts :
77
+ # Don't mutate the original capabilities.
78
+ new_opts = copy .deepcopy (moz_opts )
79
+ new_opts ['profile' ] = profile
80
+ always_match ['moz:firefoxOptions' ] = new_opts
68
81
return {"firstMatch" : [{}], "alwaysMatch" : always_match }
69
82
70
83
You can’t perform that action at this time.
0 commit comments