1414# KIND, either express or implied. See the License for the
1515# specific language governing permissions and limitations
1616# under the License.
17+ from typing import Any
18+ from typing import Dict
19+ from typing import Optional
1720from typing import Union
1821
1922from typing_extensions import deprecated
@@ -44,7 +47,7 @@ def __init__(self) -> None:
4447 # Firefox 129 onwards the CDP protocol will not be enabled by default. Setting this preference will enable it.
4548 # https://fxdx.dev/deprecating-cdp-support-in-firefox-embracing-the-future-with-webdriver-bidi/.
4649 self ._preferences ["remote.active-protocols" ] = 3
47- self ._profile = None
50+ self ._profile : Optional [ FirefoxProfile ] = None
4851 self .log = Log ()
4952
5053 @property
@@ -60,7 +63,7 @@ def binary(self, new_binary: Union[str, FirefoxBinary]) -> None:
6063 ``FirefoxBinary`` instance."""
6164 if isinstance (new_binary , FirefoxBinary ):
6265 new_binary = new_binary ._start_cmd
63- self .binary_location = new_binary
66+ self .binary_location = str ( new_binary )
6467
6568 @property
6669 def binary_location (self ) -> str :
@@ -84,7 +87,7 @@ def set_preference(self, name: str, value: Union[str, int, bool]):
8487 self ._preferences [name ] = value
8588
8689 @property
87- def profile (self ) -> FirefoxProfile :
90+ def profile (self ) -> Optional [ FirefoxProfile ] :
8891 """:Returns: The Firefox profile to use."""
8992 return self ._profile
9093
@@ -96,7 +99,9 @@ def profile(self, new_profile: Union[str, FirefoxProfile]) -> None:
9699 new_profile = FirefoxProfile (new_profile )
97100 self ._profile = new_profile
98101
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+ ):
100105 super ().enable_mobile (android_package , android_activity , device_serial )
101106
102107 def to_capabilities (self ) -> dict :
@@ -106,7 +111,7 @@ def to_capabilities(self) -> dict:
106111 # it will defer to geckodriver to find the system Firefox
107112 # and generate a fresh profile.
108113 caps = self ._caps
109- opts = {}
114+ opts : Dict [ str , Any ] = {}
110115
111116 if self ._binary_location :
112117 opts ["binary" ] = self ._binary_location
0 commit comments