微调文档

This commit is contained in:
g1879 2022-03-23 09:09:54 +08:00
parent 8b843878c2
commit 1522ef869e

View File

@ -179,7 +179,6 @@ D:\chrome.exe --remote-debugging-port=9222
from DrissionPage.configs import DriverOptions
from DrissionPage import MixPage
do = DriverOptions().set_paths(local_port=9222)
page = MixPage(driver_options=do)
```
@ -191,10 +190,10 @@ page = MixPage(driver_options=do)
如果想要同时操作多个 Chrome 浏览器,或者自己在使用 Chrome 上网,同时控制另外几个跑自动化,就须要给这些被程序控制的浏览器设置单独的端口和用户文件夹,否则会造成冲突。具体用`DriverOptions`对象进行设置,示例如下:
```python
from DrissionPage.confing import DriverOptions
from DrissionPage.config import DriverOptions
do1 = DriverOptions().set_paths(local_port=9111, user_path=r'D:\data1')
do2 = DriverOptions().set_paths(local_port=9222, user_path=r'D:\data2')
do1 = DriverOptions().set_paths(local_port=9111, user_data_path=r'D:\data1')
do2 = DriverOptions().set_paths(local_port=9222, user_data_path=r'D:\data2')
page1 = MixPage(driver_options=do1)
page2 = MixPage(driver_options=do2)
@ -214,7 +213,7 @@ D:\chrome.exe --remote-debugging-port=9222 --user-data-dir=D:\data2
```
```python
from DrissionPage.confing import DriverOptions
from DrissionPage.config import DriverOptions
do1 = DriverOptions().set_paths(local_port=9111)
do2 = DriverOptions().set_paths(local_port=9222)
@ -254,7 +253,7 @@ page.get('某url...') # 即可已登录状态访问
使用其它端口号:
```python
from DrissionPage.configs import DriverOptions
from DrissionPage.config import DriverOptions
from DrissionPage import MixPage
do = DriverOptions().set_paths(local_port=9333)
@ -262,5 +261,3 @@ page = MixPage(driver_option=do)
page.change_mode()
page.get('某url...')
```