Skip to content

Commit

Permalink
1.1.3
Browse files Browse the repository at this point in the history
  • Loading branch information
ClericPy committed Apr 6, 2020
1 parent 2f62bce commit b780dcd
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ichrome/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from .base import Chrome, ChromeDaemon, Tab, Tag
from .logs import logger

__version__ = "1.1.2"
__version__ = "1.1.3"
__tips__ = "[github]: https://github.com/ClericPy/ichrome\n[cdp]: https://chromedevtools.github.io/devtools-protocol/\n[cmd args]: https://peter.sh/experiments/chromium-command-line-switches/"
__all__ = [
'Chrome', 'ChromeDaemon', 'Tab', 'Tag', 'AsyncChrome', 'AsyncTab', 'logger',
Expand Down
18 changes: 18 additions & 0 deletions ichrome/async_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

from .base import ChromeDaemon, Tag
from .logs import logger

"""
Async utils for connections and operations.
[Recommended] Use daemon and async utils with different scripts.
Expand Down Expand Up @@ -569,6 +570,15 @@ async def wait_loading(self,
await self.send("Page.stopLoading", timeout=0)
return data

async def wait_page_loading(self,
timeout: Union[int, float] = None,
callback_function: Optional[Callable] = None,
timeout_stop_loading=False):
return self.wait_loading(
timeout=timeout,
callback_function=callback_function,
timeout_stop_loading=timeout_stop_loading)

async def wait_event(
self,
event_name: str,
Expand Down Expand Up @@ -623,6 +633,12 @@ def request_id_filter(event):
timeout=timeout,
filter_function=request_id_filter)

async def wait_loading_finished(self,
request_dict: dict,
timeout: Union[int, float] = None):
return await self.wait_request_loading(
request_dict=request_dict, timeout=timeout)

async def get_response(
self,
request_dict: dict,
Expand Down Expand Up @@ -1421,6 +1437,8 @@ def __str__(self):
return f"<Chrome({self.status}): {self.server}>"

async def close(self):
if self.status == 'closed':
return
if self.req:
await self.req.close()
self.status = 'closed'
Expand Down

0 comments on commit b780dcd

Please sign in to comment.