Robot.UIWeb ready for test in linux

dev-linux
Mikhail 2 years ago
parent 88b71835ad
commit 04afab6dde

@ -14,10 +14,22 @@ gBrowser:webdriver.Chrome = None
def BrowserChromeStart(inDriverExePathStr:str = None, inChromeExePathStr:str = None, inExtensionPathList:list = None, inProfilePathStr:str=None) -> webdriver.Chrome: def BrowserChromeStart(inDriverExePathStr:str = None, inChromeExePathStr:str = None, inExtensionPathList:list = None, inProfilePathStr:str=None) -> webdriver.Chrome:
global gBrowser 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, "..","..", "..")) lResourcePathStr = os.path.abspath(os.path.join(sys.executable, "..","..", ".."))
# Путь по умолчанию к портативному браузеру и драйверу (если скачивался репозиторий pyOpenRPA # Путь по умолчанию к портативному браузеру и драйверу (если скачивался репозиторий pyOpenRPA
if inDriverExePathStr == None: inDriverExePathStr = os.path.join(lResourcePathStr, "SeleniumWebDrivers", "Chrome", "chromedriver_win32 v84.0.4147.30", "chromedriver.exe") if inDriverExePathStr == None:
if inChromeExePathStr == None: inChromeExePathStr = os.path.join(lResourcePathStr, "WChrome64-840414730", "App", "Chrome-bin", "chrome.exe") 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 = [] if inExtensionPathList == None: inExtensionPathList = []
# Set full path to exe of the chrome # Set full path to exe of the chrome
lWebDriverChromeOptionsInstance = webdriver.ChromeOptions() lWebDriverChromeOptionsInstance = webdriver.ChromeOptions()

@ -26,6 +26,7 @@ def PathStr(inPathStr:str) -> str:
:return: Обработанная строка с учетом используемой ОС :return: Обработанная строка с учетом используемой ОС
:rtype: str :rtype: str
""" """
if inPathStr is None: return None
if IS_WINDOWS_BOOL: if IS_WINDOWS_BOOL:
return inPathStr.replace("/","\\") return inPathStr.replace("/","\\")
if IS_LINUX_BOOL: if IS_LINUX_BOOL:

Loading…
Cancel
Save