From a97e0f0e171f597e56a0100f90a4b45ad597bae5 Mon Sep 17 00:00:00 2001 From: Ivan Maslov Date: Wed, 22 Jul 2020 22:51:18 +0300 Subject: [PATCH] # Create project for WebGUI tutorial --- .gitignore | 2 ++ .../2. MonitoringModeProgrammer_Run_64.cmd | 4 +-- .../WebGUI_Habr/3. MonitoringCIAN_Run_64.cmd | 3 ++ .../WebGUI_Habr/3. MonitoringCIAN_Run_64.py | 29 +++++++++++++++++++ 4 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 Wiki/RUS_Tutorial/WebGUI_Habr/3. MonitoringCIAN_Run_64.cmd create mode 100644 Wiki/RUS_Tutorial/WebGUI_Habr/3. MonitoringCIAN_Run_64.py diff --git a/.gitignore b/.gitignore index ff3760b8..fa5de12f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ +# Игнорируем новые файлы из Google Portable +/**/Resources/GoogleChromePortable #Игнорируем все папки с названием __pycache__ /**/__pycache__/** #Игнорируем папки распакованного блокнота diff --git a/Wiki/RUS_Tutorial/DesktopGUI_Habr/2. MonitoringModeProgrammer_Run_64.cmd b/Wiki/RUS_Tutorial/DesktopGUI_Habr/2. MonitoringModeProgrammer_Run_64.cmd index 4156cf8a..978a7801 100644 --- a/Wiki/RUS_Tutorial/DesktopGUI_Habr/2. MonitoringModeProgrammer_Run_64.cmd +++ b/Wiki/RUS_Tutorial/DesktopGUI_Habr/2. MonitoringModeProgrammer_Run_64.cmd @@ -1,3 +1,3 @@ -cd %~dp0..\OpenRPA\Sources -..\Resources\WPy64-3720\python-3.7.2.amd64\python.exe "..\..\OpenRPA Habr\2. MonitoringModeProgrammer_Run_64.py" +cd %~dp0..\..\..\Sources +..\Resources\WPy64-3720\python-3.7.2.amd64\python.exe "..\Wiki\RUS_Tutorial\DesktopGUI_Habr\2. MonitoringModeProgrammer_Run_64.py" pause >nul \ No newline at end of file diff --git a/Wiki/RUS_Tutorial/WebGUI_Habr/3. MonitoringCIAN_Run_64.cmd b/Wiki/RUS_Tutorial/WebGUI_Habr/3. MonitoringCIAN_Run_64.cmd new file mode 100644 index 00000000..4583ab1f --- /dev/null +++ b/Wiki/RUS_Tutorial/WebGUI_Habr/3. MonitoringCIAN_Run_64.cmd @@ -0,0 +1,3 @@ +cd %~dp0..\..\..\Sources +..\Resources\WPy64-3720\python-3.7.2.amd64\python.exe "..\Wiki\RUS_Tutorial\WebGUI_Habr\3. MonitoringCIAN_Run_64.py" +pause >nul \ No newline at end of file diff --git a/Wiki/RUS_Tutorial/WebGUI_Habr/3. MonitoringCIAN_Run_64.py b/Wiki/RUS_Tutorial/WebGUI_Habr/3. MonitoringCIAN_Run_64.py new file mode 100644 index 00000000..74128da7 --- /dev/null +++ b/Wiki/RUS_Tutorial/WebGUI_Habr/3. MonitoringCIAN_Run_64.py @@ -0,0 +1,29 @@ +# Init Chrome web driver with extensions (if applicable) +# Import section +from selenium import webdriver + +########################## +# Init the Chrome web driver +########################### +gChromeExeFullPath = r'..\Resources\GoogleChromePortable\GoogleChromePortable.exe' +gExtensionFullPathList = [] +gWebDriverFullPath = r'..\Resources\SeleniumWebDrivers\Chrome\chromedriver_win32 v84.0.4147.30\chromedriver.exe' +def WebDriverInit(inWebDriverFullPath, inChromeExeFullPath, inExtensionFullPathList): + # Set full path to exe of the chrome + lWebDriverChromeOptionsInstance = webdriver.ChromeOptions() + lWebDriverChromeOptionsInstance.binary_location = inChromeExeFullPath + # Add extensions + for lExtensionItemFullPath in inExtensionFullPathList: + lWebDriverChromeOptionsInstance.add_extension (lExtensionItemFullPath) + # Run chrome instance + lWebDriverInstance = None + if inWebDriverFullPath: + # Run with specified web driver path + lWebDriverInstance = webdriver.Chrome(executable_path = inWebDriverFullPath, chrome_options=lWebDriverChromeOptionsInstance) + else: + lWebDriverInstance = webdriver.Chrome(chrome_options = lWebDriverChromeOptionsInstance) + # Return the result + return lWebDriverInstance + +# Инициализировать Google Chrome with selenium web driver +lWebDriver = WebDriverInit(inWebDriverFullPath = gWebDriverFullPath, inChromeExeFullPath = gChromeExeFullPath, inExtensionFullPathList = gExtensionFullPathList) \ No newline at end of file