This commit is contained in:
g1879 2023-02-22 08:42:21 +08:00
commit 4328449b51
7 changed files with 21 additions and 18 deletions

View File

@ -17,6 +17,9 @@ from .action_chains import ActionChains
from .common.keys import Keys
# 旧版页面类和启动配置类
from .mixpage.mix_page import MixPage
from .mixpage.drission import Drission
from .configs.driver_options import DriverOptions
try:
from .mixpage.mix_page import MixPage
from .mixpage.drission import Drission
from .configs.driver_options import DriverOptions
except ModuleNotFoundError:
pass

View File

@ -14,11 +14,10 @@ from requests import Session
from .chromium_base import ChromiumBase, Timeout, ChromiumBaseSetter
from .chromium_driver import ChromiumDriver
from .chromium_tab import ChromiumTab
from .configs.chromium_options import ChromiumOptions
from .configs.driver_options import DriverOptions
from .common.browser import connect_browser
from .common.errors import CallMethodError
from .common.web import set_session_cookies
from .configs.chromium_options import ChromiumOptions
from .session_page import DownloadSetter
@ -41,7 +40,7 @@ class ChromiumPage(ChromiumBase):
:param none: 用于后代继承
:return: None
"""
if not addr_driver_opts or isinstance(addr_driver_opts, (ChromiumOptions, DriverOptions)):
if not addr_driver_opts or str(type(addr_driver_opts)).endswith(("ChromiumOptions'>", "DriverOptions'>")):
self._driver_options = addr_driver_opts or ChromiumOptions(addr_driver_opts)
# 接收浏览器地址和端口

View File

@ -1,9 +1,9 @@
import click
from click import command, option
from DrissionPage.easy_set import set_paths
@click.command()
@click.option("-p", "--browser-path", help="Setting browser path.")
@command()
@option("-p", "--browser-path", help="Setting browser path.")
def main(browser_path):
"""DrissionPage CLI."""
if browser_path:

View File

@ -8,16 +8,19 @@ from pathlib import Path
from re import search
from typing import Union
from selenium import webdriver
from DrissionPage.mixpage.drission import Drission
from .common.constants import Settings
from .common.tools import unzip
from .configs.chromium_options import ChromiumOptions
from .configs.driver_options import DriverOptions
from .configs.options_manage import OptionsManager
from .session_page import SessionPage
try:
from selenium import webdriver
from DrissionPage.mixpage.drission import Drission
from .configs.driver_options import DriverOptions
except ModuleNotFoundError:
pass
def raise_when_ele_not_found(on_off=True):
"""设置全局变量,找不到元素时是否抛出异常

View File

@ -15,7 +15,6 @@ from .chromium_driver import ChromiumDriver
from .chromium_page import ChromiumPage, ChromiumDownloadSetter, ChromiumPageSetter
from .common.errors import CallMethodError
from .configs.chromium_options import ChromiumOptions
from .configs.driver_options import DriverOptions
from .configs.session_options import SessionOptions
from .session_page import SessionPage, SessionPageSetter
@ -76,7 +75,7 @@ class WebPage(SessionPage, ChromiumPage, BasePage):
elif dr_opt is False:
self._driver_options = ChromiumOptions(read_file=False)
elif isinstance(dr_opt, (ChromiumOptions, DriverOptions)):
elif str(type(dr_opt)).endswith(("ChromiumOptions'>", "DriverOptions'>")):
self._driver_options = dr_opt
else:

View File

@ -1,8 +1,8 @@
selenium
requests
tldextract
lxml
cssselect
DownloadKit>=0.5.0
FlowViewer>=0.2.1
websocket-client
websocket-client
click

View File

@ -19,7 +19,6 @@ setup(
packages=find_packages(),
zip_safe=False,
install_requires=[
"selenium",
"lxml",
"tldextract",
"requests",