Optimize some content

This commit is contained in:
zhaoyafan 2025-02-17 01:21:28 +08:00
parent c67c565dc4
commit 4a99176d22
1 changed files with 5 additions and 5 deletions

View File

@ -897,7 +897,7 @@ class Browser(InspectRequestsMixin, DriverCommonMixin, Chrome):
self.action_chains().scroll_to_element(element).perform()
self.wait(0.8)
def fetch(self, url: str, options: dict):
def fetch(self, url: str, options: dict, cover_options: dict = None):
"""
Sending http requests using fetch.
"""
@ -924,7 +924,7 @@ class Browser(InspectRequestsMixin, DriverCommonMixin, Chrome):
console.error(error);
_callback(null);
});
''', url, options or {}))
''', url, {**options, **(cover_options or {})}))
def frame_switch_to(self, element_of_frame):
"""
@ -940,7 +940,7 @@ class Browser(InspectRequestsMixin, DriverCommonMixin, Chrome):
self.switch_to.default_content()
self.wait(0.2)
def tab_create(self, url=None):
def tab_create(self, url: str = None):
"""
Create a new tab and open the URL.
"""
@ -948,7 +948,7 @@ class Browser(InspectRequestsMixin, DriverCommonMixin, Chrome):
self._update_cdp_command()
url and self.open(url)
def tab_switch(self, tab: int | str):
def tab_switch(self, tab: int | str = None):
"""
Switch the browser tab page.
"""
@ -962,7 +962,7 @@ class Browser(InspectRequestsMixin, DriverCommonMixin, Chrome):
elif tab == PositionTab.Next:
handle = (current + 1) % lengths
else:
handle = None
handle = (current + 0)
self.switch_to.window(handles[handle])
self.wait(0.2)
self._update_cdp_command()