14
14
# KIND, either express or implied. See the License for the
15
15
# specific language governing permissions and limitations
16
16
# under the License.
17
+ from typing import Any
18
+ from typing import Dict
19
+ from typing import Optional
17
20
from typing import Union
18
21
19
22
from typing_extensions import deprecated
@@ -44,7 +47,7 @@ def __init__(self) -> None:
44
47
# Firefox 129 onwards the CDP protocol will not be enabled by default. Setting this preference will enable it.
45
48
# https://fxdx.dev/deprecating-cdp-support-in-firefox-embracing-the-future-with-webdriver-bidi/.
46
49
self ._preferences ["remote.active-protocols" ] = 3
47
- self ._profile = None
50
+ self ._profile : Optional [ FirefoxProfile ] = None
48
51
self .log = Log ()
49
52
50
53
@property
@@ -60,7 +63,7 @@ def binary(self, new_binary: Union[str, FirefoxBinary]) -> None:
60
63
``FirefoxBinary`` instance."""
61
64
if isinstance (new_binary , FirefoxBinary ):
62
65
new_binary = new_binary ._start_cmd
63
- self .binary_location = new_binary
66
+ self .binary_location = str ( new_binary )
64
67
65
68
@property
66
69
def binary_location (self ) -> str :
@@ -84,7 +87,7 @@ def set_preference(self, name: str, value: Union[str, int, bool]):
84
87
self ._preferences [name ] = value
85
88
86
89
@property
87
- def profile (self ) -> FirefoxProfile :
90
+ def profile (self ) -> Optional [ FirefoxProfile ] :
88
91
""":Returns: The Firefox profile to use."""
89
92
return self ._profile
90
93
@@ -96,7 +99,9 @@ def profile(self, new_profile: Union[str, FirefoxProfile]) -> None:
96
99
new_profile = FirefoxProfile (new_profile )
97
100
self ._profile = new_profile
98
101
99
- def enable_mobile (self , android_package : str = "org.mozilla.firefox" , android_activity = None , device_serial = None ):
102
+ def enable_mobile (
103
+ self , android_package : Optional [str ] = "org.mozilla.firefox" , android_activity = None , device_serial = None
104
+ ):
100
105
super ().enable_mobile (android_package , android_activity , device_serial )
101
106
102
107
def to_capabilities (self ) -> dict :
@@ -106,7 +111,7 @@ def to_capabilities(self) -> dict:
106
111
# it will defer to geckodriver to find the system Firefox
107
112
# and generate a fresh profile.
108
113
caps = self ._caps
109
- opts = {}
114
+ opts : Dict [ str , Any ] = {}
110
115
111
116
if self ._binary_location :
112
117
opts ["binary" ] = self ._binary_location
0 commit comments