mirror of
https://gitee.com/g1879/DrissionPage.git
synced 2024-12-10 04:00:23 +08:00
wait()增加scope参数; 修复上个版本出现的找浏览器路径问题; 修复在ini设置下载路径时报错问题; 修复run_async_js()报错问题; 修复reconnect()报错问题
82 lines
2.0 KiB
Python
82 lines
2.0 KiB
Python
# -*- coding: utf-8 -*-
|
|
"""
|
|
@Author : g1879
|
|
@Contact : g1879@qq.com
|
|
@Copyright: (c) 2024 by g1879, Inc. All Rights Reserved.
|
|
@License : BSD 3-Clause.
|
|
"""
|
|
from queue import Queue
|
|
from threading import Thread, Event
|
|
from typing import Union, Callable, Dict, Optional
|
|
|
|
from requests import Response
|
|
from websocket import WebSocket
|
|
|
|
from .browser import Browser
|
|
|
|
|
|
class GenericAttr(object):
|
|
def __init__(self, name: str, tab: Driver): ...
|
|
|
|
def __getattr__(self, item: str) -> Callable: ...
|
|
|
|
def __setattr__(self, key: str, value: Callable) -> None: ...
|
|
|
|
|
|
class Driver(object):
|
|
id: str
|
|
address: str
|
|
type: str
|
|
owner = ...
|
|
alert_flag: bool
|
|
_websocket_url: str
|
|
_cur_id: int
|
|
_ws: Optional[WebSocket]
|
|
_recv_th: Thread
|
|
_handle_event_th: Thread
|
|
_handle_immediate_event_th: Optional[Thread]
|
|
_stopped: Event
|
|
event_handlers: dict
|
|
immediate_event_handlers: dict
|
|
method_results: dict
|
|
event_queue: Queue
|
|
immediate_event_queue: Queue
|
|
|
|
def __init__(self, tab_id: str, tab_type: str, address: str, owner=None): ...
|
|
|
|
def _send(self, message: dict, timeout: float = None) -> dict: ...
|
|
|
|
def _recv_loop(self) -> None: ...
|
|
|
|
def _handle_event_loop(self) -> None: ...
|
|
|
|
def _handle_immediate_event_loop(self): ...
|
|
|
|
def _handle_immediate_event(self, function: Callable, kwargs: dict): ...
|
|
|
|
def run(self, _method: str, **kwargs) -> dict: ...
|
|
|
|
def start(self) -> bool: ...
|
|
|
|
def stop(self) -> bool: ...
|
|
|
|
def _stop(self) -> None: ...
|
|
|
|
def set_callback(self, event: str, callback: Union[Callable, None], immediate: bool = False) -> None: ...
|
|
|
|
|
|
class BrowserDriver(Driver):
|
|
BROWSERS: Dict[str, Driver] = ...
|
|
owner: Browser = ...
|
|
|
|
def __new__(cls, tab_id: str, tab_type: str, address: str, owner: Browser): ...
|
|
|
|
def __init__(self, tab_id: str, tab_type: str, address: str, owner: Browser):
|
|
"""
|
|
|
|
:rtype: object
|
|
"""
|
|
...
|
|
|
|
def get(self, url) -> Response: ...
|