From 032c40e3bf17b256e8bedd5f994487d95f824789 Mon Sep 17 00:00:00 2001 From: Ivan Maslov Date: Sat, 7 Sep 2019 09:01:05 +0300 Subject: [PATCH] +SeleniumTest --- Robot/Test/SeleniumRun/Python_64_Debug.cmd | 3 +++ Robot/Test/SeleniumRun/Python_64_Script_Run.cmd | 3 +++ Robot/Test/SeleniumRun/Script.py | 17 +++++++++++++++++ Robot/Test/SeleniumRun/ScriptSeleniumInit.py | 11 +++++++++++ 4 files changed, 34 insertions(+) create mode 100644 Robot/Test/SeleniumRun/Python_64_Debug.cmd create mode 100644 Robot/Test/SeleniumRun/Python_64_Script_Run.cmd create mode 100644 Robot/Test/SeleniumRun/Script.py create mode 100644 Robot/Test/SeleniumRun/ScriptSeleniumInit.py diff --git a/Robot/Test/SeleniumRun/Python_64_Debug.cmd b/Robot/Test/SeleniumRun/Python_64_Debug.cmd new file mode 100644 index 00000000..ff45b4f6 --- /dev/null +++ b/Robot/Test/SeleniumRun/Python_64_Debug.cmd @@ -0,0 +1,3 @@ +cd %~dp0 +.\..\..\..\Resources\WPy64-3720\python-3.7.2.amd64\python.exe +pause >nul \ No newline at end of file diff --git a/Robot/Test/SeleniumRun/Python_64_Script_Run.cmd b/Robot/Test/SeleniumRun/Python_64_Script_Run.cmd new file mode 100644 index 00000000..5c6e15a2 --- /dev/null +++ b/Robot/Test/SeleniumRun/Python_64_Script_Run.cmd @@ -0,0 +1,3 @@ +cd %~dp0 +.\..\..\..\Resources\WPy64-3720\python-3.7.2.amd64\python.exe Script.py +pause >nul \ No newline at end of file diff --git a/Robot/Test/SeleniumRun/Script.py b/Robot/Test/SeleniumRun/Script.py new file mode 100644 index 00000000..e462d150 --- /dev/null +++ b/Robot/Test/SeleniumRun/Script.py @@ -0,0 +1,17 @@ +import os + +#Add chrome webdriver to PATH system enviroment (need to selenium) +os.environ["PATH"]=os.environ["PATH"]+";C:\\Abs\\Archive\\scopeSrcUL\\OpenRPA\\Resources\\SeleniumWebDrivers\\Chrome\\chromedriver_win32 v76.0.3809.126\\" + +#Import selenium +from selenium import webdriver +from selenium.webdriver.common.keys import Keys + +driver = webdriver.Chrome() +driver.get("http://www.python.org") +assert "Python" in driver.title +elem = driver.find_element_by_name("q") +elem.send_keys("pycon") +elem.send_keys(Keys.RETURN) +assert "No results found." not in driver.page_source +driver.close() \ No newline at end of file diff --git a/Robot/Test/SeleniumRun/ScriptSeleniumInit.py b/Robot/Test/SeleniumRun/ScriptSeleniumInit.py new file mode 100644 index 00000000..2bfc0c78 --- /dev/null +++ b/Robot/Test/SeleniumRun/ScriptSeleniumInit.py @@ -0,0 +1,11 @@ +import os + +#Add chrome webdriver to PATH system enviroment (need to selenium) +os.environ["PATH"]=os.environ["PATH"]+";C:\\Abs\\Archive\\scopeSrcUL\\OpenRPA\\Resources\\SeleniumWebDrivers\\Chrome\\chromedriver_win32 v76.0.3809.126\\" + +#Import selenium +from selenium import webdriver +from selenium.webdriver.common.keys import Keys + +driver = webdriver.Chrome() +driver.get("http://www.python.org") \ No newline at end of file