mirror of
https://gitee.com/g1879/DrissionPage.git
synced 2024-12-10 04:00:23 +08:00
添加run_cdp()方法
This commit is contained in:
parent
5a558308bc
commit
ca23c6b0d7
@ -1,11 +1,11 @@
|
|||||||
[paths]
|
[paths]
|
||||||
chromedriver_path = D:\coding\Chrome92\chromedriver.exe
|
chromedriver_path =
|
||||||
tmp_path =
|
tmp_path =
|
||||||
|
|
||||||
[chrome_options]
|
[chrome_options]
|
||||||
debugger_address = 127.0.0.1:9222
|
debugger_address = 127.0.0.1:9222
|
||||||
binary_location = D:\coding\Chrome92\chrome.exe
|
binary_location =
|
||||||
arguments = ['--no-sandbox', '--disable-gpu', '--ignore-certificate-errors', '--disable-infobars', '--user-data-dir=D:\\coding\\Chrome92\\user_data']
|
arguments = ['--no-sandbox', '--disable-gpu', '--ignore-certificate-errors', '--disable-infobars']
|
||||||
extensions = []
|
extensions = []
|
||||||
experimental_options = {'prefs': {'profile.default_content_settings.popups': 0, 'profile.default_content_setting_values': {'notifications': 2}, 'plugins.plugins_list': [{'enabled': False, 'name': 'Chrome PDF Viewer'}]}, 'useAutomationExtension': False, 'excludeSwitches': ['enable-automation']}
|
experimental_options = {'prefs': {'profile.default_content_settings.popups': 0, 'profile.default_content_setting_values': {'notifications': 2}, 'plugins.plugins_list': [{'enabled': False, 'name': 'Chrome PDF Viewer'}]}, 'useAutomationExtension': False, 'excludeSwitches': ['enable-automation']}
|
||||||
timeouts = {'implicit': 10.0, 'pageLoad': 30.0, 'script': 30.0}
|
timeouts = {'implicit': 10.0, 'pageLoad': 30.0, 'script': 30.0}
|
||||||
|
@ -329,6 +329,14 @@ class DriverPage(BasePage):
|
|||||||
"""
|
"""
|
||||||
return self.driver.execute_async_script(script, *args)
|
return self.driver.execute_async_script(script, *args)
|
||||||
|
|
||||||
|
def run_cdp(self, cmd: str, cmd_args: dict) -> Any:
|
||||||
|
"""执行Chrome DevTools Protocol语句
|
||||||
|
:param cmd: 协议项目
|
||||||
|
:param cmd_args: 参数
|
||||||
|
:return: 执行的结果
|
||||||
|
"""
|
||||||
|
return self.driver.execute_cdp_cmd(cmd, cmd_args)
|
||||||
|
|
||||||
def create_tab(self, url: str = '') -> None:
|
def create_tab(self, url: str = '') -> None:
|
||||||
"""新建并定位到一个标签页,该标签页在最后面 \n
|
"""新建并定位到一个标签页,该标签页在最后面 \n
|
||||||
:param url: 新标签页跳转到的网址
|
:param url: 新标签页跳转到的网址
|
||||||
|
@ -113,7 +113,7 @@ class MixPage(SessionPage, DriverPage, BasePage):
|
|||||||
|
|
||||||
def get(self,
|
def get(self,
|
||||||
url: str,
|
url: str,
|
||||||
go_anyway=True,
|
go_anyway: bool = False,
|
||||||
show_errmsg: bool = False,
|
show_errmsg: bool = False,
|
||||||
retry: int = None,
|
retry: int = None,
|
||||||
interval: float = None,
|
interval: float = None,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user