mirror of
https://gitee.com/g1879/DrissionPage.git
synced 2024-12-10 04:00:23 +08:00
微调
This commit is contained in:
parent
808c1d8745
commit
a882c1fed5
@ -512,7 +512,6 @@ class ChromiumBase(BasePage):
|
||||
self._tab_obj.Page.stopLoading()
|
||||
while self.ready_state != 'complete':
|
||||
sleep(.1)
|
||||
# self._get_document()
|
||||
|
||||
def run_cdp(self, cmd, **cmd_args):
|
||||
"""执行Chrome DevTools Protocol语句 \n
|
||||
|
@ -24,7 +24,7 @@ class OptionsManager(object):
|
||||
if not Path(self.ini_path).exists():
|
||||
raise FileNotFoundError('ini文件不存在。')
|
||||
self._conf = RawConfigParser()
|
||||
self._conf.read(self.ini_path, encoding='utf-8')
|
||||
self._conf.read(self.ini_path, encoding='utf-8-sig')
|
||||
|
||||
self._paths = None
|
||||
self._chrome_options = None
|
||||
|
@ -71,13 +71,13 @@ proxies = {'http': 'http://127.0.0.1:1080',
|
||||
# 创建配置对象,不从 ini 文件读取,并设置代理信息
|
||||
so = SessionOptions(read_file=False).set_proxies(proxies)
|
||||
# 用该配置创建页面对象(s 模式)
|
||||
page = WebPage(mode='s', session_options=so)
|
||||
page = WebPage(mode='s', session_or_options=so)
|
||||
```
|
||||
|
||||
d 模式的配置和 s 模式的配置是可以同时使用的,不会互相影响。
|
||||
|
||||
```python
|
||||
page = WebPage(mode='s', session_options=so, driver_options=do)
|
||||
page = WebPage(mode='s', session_or_options=so, driver_or_options=do)
|
||||
```
|
||||
|
||||
## 📍 使用其它 ini 文件创建
|
||||
@ -125,7 +125,7 @@ D:\chrome.exe --remote-debugging-port=9222
|
||||
from DrissionPage import WebPage, DriverOptions
|
||||
|
||||
do = DriverOptions().set_paths(local_port=9222)
|
||||
page = WebPage(driver_options=do)
|
||||
page = WebPage(driver_or_options=do)
|
||||
```
|
||||
|
||||
?>**Tips:**<br>接管使用 bat 文件打开的浏览器也是一样做法做法。<br>接管浏览器时只有`local_port`、`debugger_address`参数是有效的。
|
||||
@ -201,7 +201,7 @@ page.get('某url...') # 即可已登录状态访问
|
||||
from DrissionPage import WebPage, DriverOptions
|
||||
|
||||
do = DriverOptions().set_paths(local_port=9333)
|
||||
page = WebPage(driver_option=do)
|
||||
page = WebPage(driver_or_option=do)
|
||||
page.change_mode()
|
||||
page.get('某url...')
|
||||
```
|
||||
|
@ -48,7 +48,6 @@ set_paths(chrome_path=r"D:\chrome\chrome.exe", # 浏览器执行文件路径
|
||||
浏览器,请先关闭,否则会造成冲突。后面在 [创建页面对象](%E4%BD%BF%E7%94%A8%E6%96%B9%E6%B3%95%5C%E4%BD%BF%E5%88%9B%E5%BB%BA%E9%A1%B5%E9%9D%A2%E5%AF%B9%E8%B1%A1.md)
|
||||
章节再介绍多 Chrome 浏览器共存的方法。
|
||||
|
||||
##
|
||||
|
||||
## 登录 gitee 网站
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user