|
|
|
@ -14,10 +14,22 @@ gBrowser:webdriver.Chrome = None
|
|
|
|
|
|
|
|
|
|
def BrowserChromeStart(inDriverExePathStr:str = None, inChromeExePathStr:str = None, inExtensionPathList:list = None, inProfilePathStr:str=None) -> webdriver.Chrome:
|
|
|
|
|
global gBrowser
|
|
|
|
|
inDriverExePathStr = CrossOS.PathStr(inPathStr=inDriverExePathStr)
|
|
|
|
|
inChromeExePathStr = CrossOS.PathStr(inPathStr=inChromeExePathStr)
|
|
|
|
|
lExtensionPathList = []
|
|
|
|
|
for lItemStr in inExtensionPathList:
|
|
|
|
|
lExtensionPathList.append(CrossOS.PathStr(inPathStr=lItemStr))
|
|
|
|
|
inExtensionPathList = lExtensionPathList
|
|
|
|
|
inChromeExePathStr = CrossOS.PathStr(inPathStr=inChromeExePathStr)
|
|
|
|
|
inProfilePathStr = CrossOS.PathStr(inPathStr=inProfilePathStr)
|
|
|
|
|
lResourcePathStr = os.path.abspath(os.path.join(sys.executable, "..","..", ".."))
|
|
|
|
|
# Путь по умолчанию к портативному браузеру и драйверу (если скачивался репозиторий pyOpenRPA
|
|
|
|
|
if inDriverExePathStr == None: inDriverExePathStr = os.path.join(lResourcePathStr, "SeleniumWebDrivers", "Chrome", "chromedriver_win32 v84.0.4147.30", "chromedriver.exe")
|
|
|
|
|
if inChromeExePathStr == None: inChromeExePathStr = os.path.join(lResourcePathStr, "WChrome64-840414730", "App", "Chrome-bin", "chrome.exe")
|
|
|
|
|
if inDriverExePathStr == None:
|
|
|
|
|
if CrossOS.IS_WINDOWS_BOOL: inDriverExePathStr = os.path.join(lResourcePathStr, "SeleniumWebDrivers", "Chrome", "chromedriver_win32 v84.0.4147.30", "chromedriver.exe")
|
|
|
|
|
elif CrossOS.IS_LINUX_BOOL: inDriverExePathStr = os.path.join(lResourcePathStr, "SeleniumWebDrivers", "Chrome", "chromedriver_lin64 v103.0.5060.53", "chromedriver")
|
|
|
|
|
if inChromeExePathStr == None:
|
|
|
|
|
if CrossOS.IS_WINDOWS_BOOL: inChromeExePathStr = os.path.join(lResourcePathStr, "WChrome64-840414730", "App", "Chrome-bin", "chrome.exe")
|
|
|
|
|
elif CrossOS.IS_LINUX_BOOL: inChromeExePathStr = os.path.join(lResourcePathStr, "LChrome64-10305060114", "Data", "chrome")
|
|
|
|
|
if inExtensionPathList == None: inExtensionPathList = []
|
|
|
|
|
# Set full path to exe of the chrome
|
|
|
|
|
lWebDriverChromeOptionsInstance = webdriver.ChromeOptions()
|
|
|
|
|