added v2 as namespace in __init__, and for v1 added ChromeoptionsV2, which is just v2.ChromeOptions
This commit is contained in:
parent
fd9b6d5fd7
commit
7ddbfd00d0
|
@ -29,7 +29,10 @@ from urllib.request import urlopen, urlretrieve
|
||||||
|
|
||||||
from selenium.webdriver import Chrome as _Chrome, ChromeOptions as _ChromeOptions
|
from selenium.webdriver import Chrome as _Chrome, ChromeOptions as _ChromeOptions
|
||||||
from . import v2
|
from . import v2
|
||||||
|
from . import cdp
|
||||||
|
from . import options
|
||||||
|
|
||||||
|
ChromeOptionsV2 = v2.ChromeOptions
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
__version__ = "3.0.2"
|
__version__ = "3.0.2"
|
||||||
|
|
||||||
|
|
|
@ -21,8 +21,9 @@ import selenium.webdriver.remote.webdriver
|
||||||
from .options import ChromeOptions
|
from .options import ChromeOptions
|
||||||
from .patcher import IS_POSIX, Patcher
|
from .patcher import IS_POSIX, Patcher
|
||||||
from .reactor import Reactor
|
from .reactor import Reactor
|
||||||
|
from .cdp import CDP
|
||||||
|
|
||||||
__all__ = ("Chrome", "ChromeOptions", "Patcher", "Reactor", "find_chrome_executable")
|
__all__ = ("Chrome", "ChromeOptions", "Patcher", "Reactor", "CDP", "find_chrome_executable")
|
||||||
|
|
||||||
logger = logging.getLogger("uc")
|
logger = logging.getLogger("uc")
|
||||||
logger.setLevel(logging.getLogger().getEffectiveLevel())
|
logger.setLevel(logging.getLogger().getEffectiveLevel())
|
||||||
|
@ -570,7 +571,9 @@ class Chrome(selenium.webdriver.Chrome):
|
||||||
except Exception: # noqa
|
except Exception: # noqa
|
||||||
pass
|
pass
|
||||||
|
|
||||||
if not self.keep_user_data_dir or self.keep_user_data_dir is False:
|
if hasattr(self, 'keep_user_data_dir') \
|
||||||
|
and not self.keep_user_data_dir \
|
||||||
|
or self.keep_user_data_dir is False:
|
||||||
for _ in range(3):
|
for _ in range(3):
|
||||||
try:
|
try:
|
||||||
logger.debug("removing profile : %s" % self.user_data_dir)
|
logger.debug("removing profile : %s" % self.user_data_dir)
|
||||||
|
@ -581,9 +584,13 @@ class Chrome(selenium.webdriver.Chrome):
|
||||||
logger.debug(
|
logger.debug(
|
||||||
"permission error. files are still in use/locked. retying..."
|
"permission error. files are still in use/locked. retying..."
|
||||||
)
|
)
|
||||||
|
except (RuntimeError, OSError) as e:
|
||||||
|
logger.debug(
|
||||||
|
"%s retying..." % e
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
break
|
break
|
||||||
time.sleep(1)
|
time.sleep(.25)
|
||||||
|
|
||||||
def __del__(self):
|
def __del__(self):
|
||||||
logger.debug("Chrome.__del__")
|
logger.debug("Chrome.__del__")
|
||||||
|
|
Loading…
Reference in New Issue