更新README

This commit is contained in:
g1879 2020-07-20 16:58:05 +08:00
parent 541c0da6da
commit 92c77efc02
2 changed files with 184 additions and 6 deletions

View File

@ -600,7 +600,7 @@ print(page.ele('@id:su').text) # Output:百度一下
## Drission class
​ class **Drission**(driver_options: Union[dict, Options] = None, session_options: dict = None, driver_path: str = None, ini_path = None, proxy: dict = None)
​ class **Drission**(driver_options: Union[dict, Options] = None, session_options: dict = None, ini_path = None, proxy: dict = None)
​ Used to manage driver and session objects.
@ -608,7 +608,6 @@ print(page.ele('@id:su').text) # Output:百度一下
- driver_options - Chrome configuration parameters, can receive Options object or dictionary
- session_options - session configuration parameters, receive dictionary
- driver_path - chromedriver.exe path, if not set, system variables must be set in the system
- ini_path - ini file path, the default is the ini file in the DrissionPage folder
### session
@ -1419,6 +1418,10 @@ Parameter Description:
- read_file - Boolean, specifies whether to read configuration information from the ini file when creating
### driver_path
​ Path of chromedriver.exe.
### remove_argument
​ remove_argument(value: str) -> None
@ -1445,7 +1448,7 @@ Parameter Description:
​ Remove all plug-ins, because the plug-in is stored in the entire file, it is difficult to remove one of them, so if you need to set, remove all and reset.
### save()
### save
​ save(path: str = None) -> None
@ -1455,6 +1458,92 @@ Parameter Description:
- path - The path of the ini file, which is saved to the module folder by default
### set_argument
​ set_argument(arg: str, value: Union[bool, str]) -> None
​ Set the chrome attribute, the attribute with no value can be set to switch, the attribute with the value can set the value of the attribute.
​ Parameter description:
- arg - attribute name
- value - the attribute value, the attribute with value is passed in the value, the attribute without value is passed in bool
### set_headless
​ set_headless(on_off: bool = True) -> None
​ Turn on or off the interfaceless mode.
​ Parameter Description:
​ on_off - open or close, bool
### set_no_imgs
​ set_no_imgs(on_off: bool = True) -> None
​ Whether to load pictures.
​ Parameter Description:
​ on_off - open or close, bool
### set_no_js
​ set_no_js(on_off: bool = True) -> None
​ Whether to disable js.
​ Parameter Description:
​ on_off - open or close, bool
### set_mute
​ set_mute(on_off: bool = True) -> None
​ Whether to mute.
​ Parameter Description:
​ on_off - open or close, bool
### set_user_agent
​ set_user_agent(user_agent: str) -> None
​ Set the browser user agent.
​ Parameter Description:
- user_agent - user agent string
### set_proxy
​ set_proxy(proxy: str) -> None
​ Set up a proxy.
​ Parameter Description:
- proxy - proxy address
### set_paths
​ set_paths(driver_path: str = None, chrome_path: str = None, debugger_address: str = None, download_path: str = None, user_data_path: str = None, cache_path: str = None) -> None
​ Set browser-related paths.
​ Parameter Description:
- driver_path - path of chromedriver.exe
- chrome_path - path of chrome.exe
- debugger_address - debug browser address, for example: 127.0.0.1:9222
- download_path - download file path
- user_data_path - user data path
- cache_path - cache path
## easy_set methods

View File

@ -597,7 +597,7 @@ print(page.ele('@id:su').text) # 输出:百度一下
## Drission类
class **Drission**(driver_options: Union[dict, Options] = None, session_options: dict = None, driver_path: str = None, ini_path: str = None, proxy: dict = None)
class **Drission**(driver_options: Union[dict, Options] = None, session_options: dict = None, ini_path: str = None, proxy: dict = None)
用于管理driver和session对象。
@ -605,7 +605,6 @@ class **Drission**(driver_options: Union[dict, Options] = None, session_options:
- driver_options - chrome配置参数,可接收Options对象或字典
- session_options - session配置参数,接收字典
- driver_path - chromedriver.exe路径,如不设置,须在系统设置系统变量
- ini_path - ini文件路径,默认为DrissionPage文件夹下的ini文件
### session
@ -1416,6 +1415,10 @@ session模式的元素对象,包装了一个Element对象,并封装了常用
- read_file - 布尔型,指定创建时是否从ini文件读取配置信息
### driver_path
​ chromedriver.exe的路径。
### remove_argument
​ remove_argument(value: str) -> None
@ -1442,7 +1445,7 @@ session模式的元素对象,包装了一个Element对象,并封装了常用
​ 移除所有插件,因插件是以整个文件储存,难以移除其中一个,故如须设置则全部移除再重设。
### save()
### save
​ save(path: str = None) -> None
@ -1452,6 +1455,92 @@ session模式的元素对象,包装了一个Element对象,并封装了常用
- path - ini文件的路径,默认保存到模块文件夹下的
### set_argument
​ set_argument(arg: str, value: Union[bool, str]) -> None
​ 设置chrome属性,无值的属性可设置开关,有值的属性可设置属性的值。
​ 参数说明:
- arg - 属性名
- value - 属性值,有值的属性传入值,没有的传入bool
### set_headless
​ set_headless(on_off: bool = True) -> None
​ 打开或关闭无界面模式。
​ 参数说明:
​ on_off - 打开或关闭,bool
### set_no_imgs
​ set_no_imgs(on_off: bool = True) -> None
​ 是否加载图片。
​ 参数说明:
​ on_off - 打开或关闭,bool
### set_no_js
​ set_no_js(on_off: bool = True) -> None
​ 是否禁用js。
​ 参数说明:
​ on_off - 打开或关闭,bool
### set_mute
​ set_mute(on_off: bool = True) -> None
​ 是否静音。
​ 参数说明:
​ on_off - 打开或关闭,bool
### set_user_agent
​ set_user_agent(user_agent: str) -> None
​ 设置浏览器user agent。
​ 参数说明:
- user_agent - user agent字符串
### set_proxy
​ set_proxy(proxy: str) -> None
​ 设置代理。
​ 参数说明:
- proxy - 代理地址
### set_paths
​ set_paths(driver_path: str = None, chrome_path: str = None, debugger_address: str = None, download_path: str = None, user_data_path: str = None, cache_path: str = None) -> None
​ 设置浏览器相关的路径。
​ 参数说明:
- driver_path - chromedriver.exe的路径
- chrome_path - chrome.exe的路径
- debugger_address - 调试浏览器地址,例:127.0.0.1:9222
- download_path - 下载文件路径
- user_data_path - 用户数据路径
- cache_path - 缓存路径
## easy_set方法