diff --git a/Python_basics/.project b/.project similarity index 87% rename from Python_basics/.project rename to .project index b0d7875..a855841 100644 --- a/Python_basics/.project +++ b/.project @@ -1,6 +1,6 @@ - Python_basics + com.python.test diff --git a/Python_basics/.pydevproject b/.pydevproject similarity index 81% rename from Python_basics/.pydevproject rename to .pydevproject index 644bfe2..6b50e52 100644 --- a/Python_basics/.pydevproject +++ b/.pydevproject @@ -1,10 +1,9 @@ +Default +python interpreter /${PROJECT_DIR_NAME} -/${PROJECT_DIR_NAME}/PDF_documents -/${PROJECT_DIR_NAME}/bc +/${PROJECT_DIR_NAME}/main -python interpreter -Default diff --git a/Drivers/chromedriver.exe b/Drivers/chromedriver.exe new file mode 100644 index 0000000..4850c8d Binary files /dev/null and b/Drivers/chromedriver.exe differ diff --git a/Python_basics/AdvancedDataTypes/022 listdemo.py b/Python_basics/AdvancedDataTypes/022 listdemo.py deleted file mode 100644 index 8e5f6ba..0000000 --- a/Python_basics/AdvancedDataTypes/022 listdemo.py +++ /dev/null @@ -1,26 +0,0 @@ -""" -Data type to store more than one value in one variable name -List items are in brackets, separated with "," [ 1, 2, 3 ] -""" - -cars = [ "bmw", "honda", "audi"] -empty_list = [] -print(empty_list) -print(cars) - -print("*#"*20) - -print(cars[1]) - -num_list = [1, 2, 3] -sum_num = num_list[0] + num_list[1] - -print(sum_num) - -more_cars = [ "bmw", "honda", "audi"] -print(more_cars[1]) - -more_cars[1] = "Benz" - -print(more_cars[1]) -print(more_cars) \ No newline at end of file diff --git a/Python_basics/AdvancedDataTypes/023 listmethods.py b/Python_basics/AdvancedDataTypes/023 listmethods.py deleted file mode 100644 index b8527de..0000000 --- a/Python_basics/AdvancedDataTypes/023 listmethods.py +++ /dev/null @@ -1,35 +0,0 @@ -""" -Built-in methods to help manipulating a list -""" - -cars = [ "bmw", "honda", "audi"] - -length = len(cars) -print(length) - -cars.append("Benz") -print(cars) - -cars.insert(1, "Jeep") -print(cars) - -x = cars.index("honda") -print(x) - -y = cars.pop() -print(y) -print(cars) - -cars.remove("Jeep") -print(cars) - -slicing = cars[0:2] -a = cars[1:] -print(slicing) -print(a) - -print("*#"*20) -print(cars) -cars.sort() - -print(cars) \ No newline at end of file diff --git a/Python_basics/AdvancedDataTypes/024 dictdemo.py b/Python_basics/AdvancedDataTypes/024 dictdemo.py deleted file mode 100644 index 6070044..0000000 --- a/Python_basics/AdvancedDataTypes/024 dictdemo.py +++ /dev/null @@ -1,26 +0,0 @@ -""" -Data type to store more than one value in one variable name, in terms of key value pairs -Dictionary items are in brackets {} in key:value pairs, separated with "," {'k1':'v1', 'k2':'v2'} -Not sequenced, no indexing -> Mapping -""" - -car = {'make': 'bmw', 'model': '550i', 'year': 2016} -print(car) - -d = {} - -model = car['model'] - -print(car['make']) -print(model) - -d['one'] = 1 -d['two'] = 2 - -print(d) - -sum_1 = d['two'] + 8 -print(sum_1) -print(d) -d['two'] = d['two'] + 8 -print(d) \ No newline at end of file diff --git a/Python_basics/AdvancedDataTypes/025 dictnested.py b/Python_basics/AdvancedDataTypes/025 dictnested.py deleted file mode 100644 index 7fa2261..0000000 --- a/Python_basics/AdvancedDataTypes/025 dictnested.py +++ /dev/null @@ -1,10 +0,0 @@ -""" -Nested Dictionary: -d = {'k1': {'nestk1':'nestvalue1', 'nestk2': 'nestvalue2'}} -d['k1']['nestk1'] -""" - -cars = {'bmw': {'model': '550i', 'year': 2016}, 'benz': {'model': 'E350', 'year': 2015}} -bmw_year = cars['bmw']['year'] -print(bmw_year) -print(cars['benz']['model']) \ No newline at end of file diff --git a/Python_basics/AdvancedDataTypes/026 dictmethods.py b/Python_basics/AdvancedDataTypes/026 dictmethods.py deleted file mode 100644 index b0bc792..0000000 --- a/Python_basics/AdvancedDataTypes/026 dictmethods.py +++ /dev/null @@ -1,22 +0,0 @@ -''' -Created on May 30, 2018 -@author: venkateshwara.d -''' -""" -Dictionary Methods -""" - -car = {'make': 'bmw', 'model': '550i', 'year': 2016} -cars = {'bmw': {'model': '550i', 'year': 2016}, 'benz': {'model': 'E350', 'year': 2015}} - -print(car.keys()) -print(cars.keys()) -print(car.values()) -print(cars.values()) -print(car.items()) - -car_copy = car.copy() -print(car_copy) - -print(car.pop('model')) -print(car) diff --git a/Python_basics/AdvancedDataTypes/027 tuplesdemo.py b/Python_basics/AdvancedDataTypes/027 tuplesdemo.py deleted file mode 100644 index 79c2aed..0000000 --- a/Python_basics/AdvancedDataTypes/027 tuplesdemo.py +++ /dev/null @@ -1,22 +0,0 @@ -""" -Tuple -Like list but they are immutable -It means you can't change them -""" - -my_list = [1, 2, 3] -print(my_list) - -my_list[0] = 0 -print(my_list) - -my_tuple = (1, 2, 3, 2, 2, 3) -print(my_tuple) - -print(my_tuple[0]) - -print(my_tuple[1:]) - -print(my_tuple.index(2)) - -print(my_tuple.count(3)) \ No newline at end of file diff --git a/Python_basics/AdvancedLocators_CSS/073 FindByIdName.py b/Python_basics/AdvancedLocators_CSS/073 FindByIdName.py deleted file mode 100644 index 166ee03..0000000 --- a/Python_basics/AdvancedLocators_CSS/073 FindByIdName.py +++ /dev/null @@ -1,27 +0,0 @@ -''' -Created on May 30, 2018 -@author: venkateshwara.d -''' -from selenium import webdriver - -class FindByIdName(): - - def test(self): - baseUrl = "https://letskodeit.teachable.com/pages/practice" - - chrome_driver_path = os.path.abspath('..') + "\\Drivers\\chromedriver.exe" - - driver=webdriver.Chrome(chrome_driver_path) - driver.get(baseUrl) - elementById = driver.find_element_by_id("name") - - if elementById is not None: - print("We found an element by Id") - - elementByName = driver.find_element_by_name("show-hide") - - if elementByName is not None: - print("We found an element by Name") - -ff = FindByIdName() -ff.test() diff --git a/Python_basics/AdvancedLocators_CSS/074 FindByIdName.py b/Python_basics/AdvancedLocators_CSS/074 FindByIdName.py deleted file mode 100644 index 3a87518..0000000 --- a/Python_basics/AdvancedLocators_CSS/074 FindByIdName.py +++ /dev/null @@ -1,32 +0,0 @@ -''' -Created on May 30, 2018 -@author: venkateshwara.d -''' -from selenium import webdriver - -class FindByIdName(): - - def test(self): - baseUrl = "https://letskodeit.teachable.com/pages/practice" - chrome_driver_path = os.path.abspath('..') + "\\Drivers\\chromedriver.exe" - - driver=webdriver.Chrome(chrome_driver_path) - driver.get(baseUrl) - elementById = driver.find_element_by_id("name") - - if elementById is not None: - print("We found an element by Id") - - elementByName = driver.find_element_by_name("show-hide") - - if elementByName is not None: - print("We found an element by Name") - - driver.get("https://www.yahoo.com/") - # This one should fail because the Id is not static - # Exception thrown: NoSuchElementException - driver.find_element_by_id("yui_3_18_0_4_1463100170626_1148") - driver.close() - -ff = FindByIdName() -ff.test() diff --git a/Python_basics/AdvancedLocators_CSS/075 FindByXPathCSS.py b/Python_basics/AdvancedLocators_CSS/075 FindByXPathCSS.py deleted file mode 100644 index ee9a566..0000000 --- a/Python_basics/AdvancedLocators_CSS/075 FindByXPathCSS.py +++ /dev/null @@ -1,26 +0,0 @@ -''' -Created on May 30, 2018 -@author: venkateshwara.d -''' -from selenium import webdriver - -class FindByXPathCSS(): - - def test(self): - baseUrl = "https://letskodeit.teachable.com/pages/practice" - chrome_driver_path = os.path.abspath('..') + "\\Drivers\\chromedriver.exe" - - driver=webdriver.Chrome(chrome_driver_path) - driver.get(baseUrl) - elementByXpath = driver.find_element_by_xpath("//input[@id='name']") - - if elementByXpath is not None: - print("We found an element by XPATH") - - elementByCss = driver.find_element_by_css_selector("#displayed-text") - - if elementByCss is not None: - print("We found an element by CSS") - -ff = FindByXPathCSS() -ff.test() diff --git a/Python_basics/AdvancedLocators_CSS/076 FindByLinkText.py b/Python_basics/AdvancedLocators_CSS/076 FindByLinkText.py deleted file mode 100644 index e80bcc0..0000000 --- a/Python_basics/AdvancedLocators_CSS/076 FindByLinkText.py +++ /dev/null @@ -1,27 +0,0 @@ -''' -Created on May 30, 2018 -@author: venkateshwara.d -''' -from selenium import webdriver - -class FindByLinkText(): - - def test(self): - baseUrl = "https://letskodeit.teachable.com/pages/practice" - chrome_driver_path = os.path.abspath('..') + "\\Drivers\\chromedriver.exe" - - driver=webdriver.Chrome(chrome_driver_path) - driver.get(baseUrl) - - elementByLinkText = driver.find_element_by_link_text("Login") - - if elementByLinkText is not None: - print("We found an element by Link Text") - - elementByPartialLinkText = driver.find_element_by_partial_link_text("Pract") - - if elementByPartialLinkText is not None: - print("We found an element by Partial Link Text") - -ff = FindByLinkText() -ff.test() diff --git a/Python_basics/AdvancedLocators_CSS/077 FindByClassTag.py b/Python_basics/AdvancedLocators_CSS/077 FindByClassTag.py deleted file mode 100644 index 91aa6c5..0000000 --- a/Python_basics/AdvancedLocators_CSS/077 FindByClassTag.py +++ /dev/null @@ -1,29 +0,0 @@ -''' -Created on May 30, 2018 -@author: venkateshwara.d -''' -from selenium import webdriver - -class FindByClassTag(): - - def test(self): - baseUrl = "https://letskodeit.teachable.com/pages/practice" - chrome_driver_path = os.path.abspath('..') + "\\Drivers\\chromedriver.exe" - - driver=webdriver.Chrome(chrome_driver_path) - driver.get(baseUrl) - - elementByClassName = driver.find_element_by_class_name("displayed-class") - elementByClassName.send_keys("Testing The Element") - - if elementByClassName is not None: - print("We found an element by Class Name") - - elementByTagName = driver.find_element_by_tag_name("h1") - text = elementByTagName.text - - if elementByTagName is not None: - print("We found an element by Tag Name and the text on element is: " + text) - -ff = FindByClassTag() -ff.test() diff --git a/Python_basics/AdvancedLocators_CSS/078 ByDemo.py b/Python_basics/AdvancedLocators_CSS/078 ByDemo.py deleted file mode 100644 index fda3f82..0000000 --- a/Python_basics/AdvancedLocators_CSS/078 ByDemo.py +++ /dev/null @@ -1,33 +0,0 @@ -''' -Created on May 30, 2018 -@author: venkateshwara.d -''' -from selenium import webdriver -from selenium.webdriver.common.by import By - -class ByDemo(): - - def test(self): - baseUrl = "https://letskodeit.teachable.com/pages/practice" - chrome_driver_path = os.path.abspath('..') + "\\Drivers\\chromedriver.exe" - - driver=webdriver.Chrome(chrome_driver_path) - driver.get(baseUrl) - - elementById = driver.find_element(By.ID, "name") - - if elementById is not None: - print("We found an element by Id") - - elementByXpath = driver.find_element(By.XPATH, "//input[@id='displayed-text']") - - if elementByXpath is not None: - print("We found an element by XPATH") - - elementByLinkText = driver.find_element(By.LINK_TEXT, "Login") - - if elementByLinkText is not None: - print("We found an element by Link Text") - -ff = ByDemo() -ff.test() diff --git a/Python_basics/AdvancedLocators_CSS/079 ListOfElements.py b/Python_basics/AdvancedLocators_CSS/079 ListOfElements.py deleted file mode 100644 index 97f246c..0000000 --- a/Python_basics/AdvancedLocators_CSS/079 ListOfElements.py +++ /dev/null @@ -1,30 +0,0 @@ -''' -Created on May 30, 2018 -@author: venkateshwara.d -''' -from selenium import webdriver -from selenium.webdriver.common.by import By - -class ListOfElements(): - - def test(self): - baseUrl = "https://letskodeit.teachable.com/pages/practice" - chrome_driver_path = os.path.abspath('..') + "\\Drivers\\chromedriver.exe" - - driver=webdriver.Chrome(chrome_driver_path) - driver.get(baseUrl) - - elementListByClassName = driver.find_elements_by_class_name("inputs") - length1 = len(elementListByClassName) - - if elementListByClassName is not None: - print("ClassName -> Size of the list is: " + str(length1)) - - elementListByTagName = driver.find_elements(By.TAG_NAME, "td") - length2 = len(elementListByTagName) - - if elementListByTagName is not None: - print("TagName -> Size of the list is: " + str(length2)) - -ff = ListOfElements() -ff.test() diff --git a/Python_basics/AdvancedLocators_CSS/080 Interview-Questions.pdf b/Python_basics/AdvancedLocators_CSS/080 Interview-Questions.pdf deleted file mode 100644 index f649670..0000000 Binary files a/Python_basics/AdvancedLocators_CSS/080 Interview-Questions.pdf and /dev/null differ diff --git a/Python_basics/AdvancedLocators_CSS/093 XPath-Cheat-Sheet.pdf b/Python_basics/AdvancedLocators_CSS/093 XPath-Cheat-Sheet.pdf deleted file mode 100644 index b602485..0000000 Binary files a/Python_basics/AdvancedLocators_CSS/093 XPath-Cheat-Sheet.pdf and /dev/null differ diff --git a/Python_basics/AdvancedLocators_CSS/__init__.py b/Python_basics/AdvancedLocators_CSS/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/Python_basics/Au3Record.rar b/Python_basics/Au3Record.rar deleted file mode 100644 index a5961a2..0000000 Binary files a/Python_basics/Au3Record.rar and /dev/null differ diff --git a/Python_basics/AutomationFramework_Part_1/163 3-login-tests.py b/Python_basics/AutomationFramework_Part_1/163 3-login-tests.py deleted file mode 100644 index 45fb5a4..0000000 --- a/Python_basics/AutomationFramework_Part_1/163 3-login-tests.py +++ /dev/null @@ -1,36 +0,0 @@ -''' -Created on May 30, 2018 -@author: venkateshwara.d -''' -from selenium import webdriver -from selenium.webdriver.common.by import By - -class LoginTests(): - - def test_validLogin(self): - baseURL = "https://letskodeit.teachable.com/" - driver = webdriver.Firefox() - driver.maximize_window() - driver.implicitly_wait(3) - driver.get(baseURL) - - loginLink = driver.find_element(By.LINK_TEXT, "Login") - loginLink.click() - - emailField = driver.find_element(By.ID, "user_email") - emailField.send_keys("test@email.com") - - passwordField = driver.find_element(By.ID, "user_password") - passwordField.send_keys("abcabc") - - loginButton = driver.find_element(By.NAME, "commit") - loginButton.click() - - userIcon = driver.find_element(By.XPATH, ".//*[@id='navbar']//span[text()='User Settings']") - if userIcon is not None: - print("Login Successful") - else: - print("Login Failed") - -ff = LoginTests() -ff.test_validLogin() diff --git a/Python_basics/AutomationFramework_Part_1/165 4-login-tests.py b/Python_basics/AutomationFramework_Part_1/165 4-login-tests.py deleted file mode 100644 index df09c65..0000000 --- a/Python_basics/AutomationFramework_Part_1/165 4-login-tests.py +++ /dev/null @@ -1,26 +0,0 @@ -''' -Created on May 30, 2018 -@author: venkateshwara.d -''' -from selenium import webdriver -from selenium.webdriver.common.by import By -from pages.home.login_page import LoginPage -import unittest - -class LoginTests(unittest.TestCase): - - def test_validLogin(self): - baseURL = "https://letskodeit.teachable.com/" - driver = webdriver.Firefox() - driver.maximize_window() - driver.implicitly_wait(3) - driver.get(baseURL) - - lp = LoginPage(driver) - lp.login("test@email.com", "abcabc") - - userIcon = driver.find_element(By.XPATH, ".//*[@id='navbar']//span[text()='User Settings']") - if userIcon is not None: - print("Login Successful") - else: - print("Login Failed") diff --git a/Python_basics/AutomationFramework_Part_1/166 5-login-page.py b/Python_basics/AutomationFramework_Part_1/166 5-login-page.py deleted file mode 100644 index f3f8b28..0000000 --- a/Python_basics/AutomationFramework_Part_1/166 5-login-page.py +++ /dev/null @@ -1,46 +0,0 @@ -''' -Created on May 30, 2018 -@author: venkateshwara.d -''' -from selenium.webdriver.common.by import By - -class LoginPage(): - - def __init__(self, driver): - self.driver = driver - - # Locators - _login_link = "Login" - _email_field = "user_email" - _password_field = "user_password" - _login_button = "commit" - - def getLoginLink(self): - return self.driver.find_element(By.LINK_TEXT, self._login_link) - - def getEmailField(self): - return self.driver.find_element(By.ID, self._email_field) - - def getPasswordField(self): - return self.driver.find_element(By.ID, self._password_field) - - def getLoginButton(self): - return self.driver.find_element(By.NAME, self._login_button) - - def clickLoginLink(self): - self.getLoginLink().click() - - def enterEmail(self, email): - self.getEmailField().send_keys(email) - - def enterPassword(self, password): - self.getPasswordField().send_keys(password) - - def clickLoginButton(self): - self.getLoginButton().click() - - def login(self, email, password): - self.clickLoginLink() - self.enterEmail(email) - self.enterPassword(password) - self.clickLoginButton() diff --git a/Python_basics/AutomationFramework_Part_1/167 6-selenium-driver.py b/Python_basics/AutomationFramework_Part_1/167 6-selenium-driver.py deleted file mode 100644 index c7e20b1..0000000 --- a/Python_basics/AutomationFramework_Part_1/167 6-selenium-driver.py +++ /dev/null @@ -1,97 +0,0 @@ -''' -Created on May 30, 2018 -@author: venkateshwara.d -''' -from selenium.webdriver.common.by import By -from traceback import print_stack -from selenium.webdriver.support.ui import WebDriverWait -from selenium.webdriver.support import expected_conditions as EC -from selenium.common.exceptions import * - -class SeleniumDriver(): - - def __init__(self, driver): - self.driver = driver - - def getByType(self, locatorType): - locatorType = locatorType.lower() - if locatorType == "id": - return By.ID - elif locatorType == "name": - return By.NAME - elif locatorType == "xpath": - return By.XPATH - elif locatorType == "css": - return By.CSS_SELECTOR - elif locatorType == "classname": - return By.CLASS_NAME - elif locatorType == "linktext": - return By.LINK_TEXT - else: - print("Locator type " + locatorType + " not correct/supported") - return False - - def getElement(self, locator, locatorType="id"): - element = None - try: - locatorType = locatorType.lower() - byType = self.getByType(locatorType) - element = self.driver.find_element(byType, locator) - print("Element Found") - except: - print("Element not found") - return element - - def elementClick(self, locator, locatorType="id"): - try: - element = self.getElement(locator, locatorType) - element.click() - print("Clicked on element with locator: " + locator + " locatorType: " + locatorType) - except: - print("Cannot click on the element with locator: " + locator + " locatorType: " + locatorType) - print_stack() - - def isElementPresent(self, locator, byType): - try: - element = self.driver.find_element(byType, locator) - if element is not None: - print("Element Found") - return True - else: - print("Element not found") - return False - except: - print("Element not found") - return False - - def elementPresenceCheck(self, locator, byType): - try: - elementList = self.driver.find_elements(byType, locator) - if len(elementList) > 0: - print("Element Found") - return True - else: - print("Element not found") - return False - except: - print("Element not found") - return False - - def waitForElement(self, locator, locatorType="id", - timeout=10, pollFrequency=0.5): - element = None - try: - byType = self.getByType(locatorType) - print("Waiting for maximum :: " + str(timeout) + - " :: seconds for element to be clickable") - wait = WebDriverWait(self.driver, 10, poll_frequency=1, - ignored_exceptions=[NoSuchElementException, - ElementNotVisibleException, - ElementNotSelectableException]) - element = wait.until(EC.element_to_be_clickable((byType, - "stopFilter_stops-0"))) - print("Element appeared on the web page") - except: - print("Element not appeared on the web page") - print_stack() - return element diff --git a/Python_basics/AutomationFramework_Part_1/168 7-selenium-driver.py b/Python_basics/AutomationFramework_Part_1/168 7-selenium-driver.py deleted file mode 100644 index 87c788a..0000000 --- a/Python_basics/AutomationFramework_Part_1/168 7-selenium-driver.py +++ /dev/null @@ -1,107 +0,0 @@ -''' -Created on May 30, 2018 -@author: venkateshwara.d -''' -from selenium.webdriver.common.by import By -from traceback import print_stack -from selenium.webdriver.support.ui import WebDriverWait -from selenium.webdriver.support import expected_conditions as EC -from selenium.common.exceptions import * - -class SeleniumDriver(): - - def __init__(self, driver): - self.driver = driver - - def getByType(self, locatorType): - locatorType = locatorType.lower() - if locatorType == "id": - return By.ID - elif locatorType == "name": - return By.NAME - elif locatorType == "xpath": - return By.XPATH - elif locatorType == "css": - return By.CSS_SELECTOR - elif locatorType == "class": - return By.CLASS_NAME - elif locatorType == "link": - return By.LINK_TEXT - else: - print("Locator type " + locatorType + " not correct/supported") - return False - - def getElement(self, locator, locatorType="id"): - element = None - try: - locatorType = locatorType.lower() - byType = self.getByType(locatorType) - element = self.driver.find_element(byType, locator) - print("Element Found with locator: " + locator + " and locatorType: " + locatorType) - except: - print("Element not found with locator: " + locator + " and locatorType: " + locatorType) - return element - - def elementClick(self, locator, locatorType="id"): - try: - element = self.getElement(locator, locatorType) - element.click() - print("Clicked on element with locator: " + locator + " locatorType: " + locatorType) - except: - print("Cannot click on the element with locator: " + locator + " locatorType: " + locatorType) - print_stack() - - def sendKeys(self, data, locator, locatorType="id"): - try: - element = self.getElement(locator, locatorType) - element.send_keys(data) - print("Sent data on element with locator: " + locator + " locatorType: " + locatorType) - except: - print("Cannot send data on the element with locator: " + locator + - " locatorType: " + locatorType) - print_stack() - - def isElementPresent(self, locator, locatorType="id"): - try: - element = self.getElement(locator, locatorType) - if element is not None: - print("Element Found") - return True - else: - print("Element not found") - return False - except: - print("Element not found") - return False - - def elementPresenceCheck(self, locator, byType): - try: - elementList = self.driver.find_elements(byType, locator) - if len(elementList) > 0: - print("Element Found") - return True - else: - print("Element not found") - return False - except: - print("Element not found") - return False - - def waitForElement(self, locator, locatorType="id", - timeout=10, pollFrequency=0.5): - element = None - try: - byType = self.getByType(locatorType) - print("Waiting for maximum :: " + str(timeout) + - " :: seconds for element to be clickable") - wait = WebDriverWait(self.driver, 10, poll_frequency=1, - ignored_exceptions=[NoSuchElementException, - ElementNotVisibleException, - ElementNotSelectableException]) - element = wait.until(EC.element_to_be_clickable((byType, - "stopFilter_stops-0"))) - print("Element appeared on the web page") - except: - print("Element not appeared on the web page") - print_stack() - return element diff --git a/Python_basics/AutomationFramework_Part_1/__init__.py b/Python_basics/AutomationFramework_Part_1/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/Python_basics/AutomationFramework_Part_2/169 1-selenium-driver.py b/Python_basics/AutomationFramework_Part_2/169 1-selenium-driver.py deleted file mode 100644 index 0c650a6..0000000 --- a/Python_basics/AutomationFramework_Part_2/169 1-selenium-driver.py +++ /dev/null @@ -1,117 +0,0 @@ -''' -Created on May 30, 2018 -@author: venkateshwara.d -''' -from selenium.webdriver.common.by import By -from traceback import print_stack -from selenium.webdriver.support.ui import WebDriverWait -from selenium.webdriver.support import expected_conditions as EC -from selenium.common.exceptions import * -import utilities.custom_logger as cl -import logging - -class SeleniumDriver(): - - log = cl.customLogger(logging.DEBUG) - - def __init__(self, driver): - self.driver = driver - - def getByType(self, locatorType): - locatorType = locatorType.lower() - if locatorType == "id": - return By.ID - elif locatorType == "name": - return By.NAME - elif locatorType == "xpath": - return By.XPATH - elif locatorType == "css": - return By.CSS_SELECTOR - elif locatorType == "class": - return By.CLASS_NAME - elif locatorType == "link": - return By.LINK_TEXT - else: - self.log.info("Locator type " + locatorType + - " not correct/supported") - return False - - def getElement(self, locator, locatorType="id"): - element = None - try: - locatorType = locatorType.lower() - byType = self.getByType(locatorType) - element = self.driver.find_element(byType, locator) - self.log.info("Element found with locator: " + locator + - " and locatorType: " + locatorType) - except: - self.log.info("Element not found with locator: " + locator + - " and locatorType: " + locatorType) - return element - - def elementClick(self, locator, locatorType="id"): - try: - element = self.getElement(locator, locatorType) - element.click() - self.log.info("Clicked on element with locator: " + locator + - " locatorType: " + locatorType) - except: - self.log.info("Cannot click on the element with locator: " + locator + - " locatorType: " + locatorType) - print_stack() - - def sendKeys(self, data, locator, locatorType="id"): - try: - element = self.getElement(locator, locatorType) - element.send_keys(data) - self.log.info("Sent data on element with locator: " + locator + - " locatorType: " + locatorType) - except: - self.log.info("Cannot send data on the element with locator: " + locator + - " locatorType: " + locatorType) - print_stack() - - def isElementPresent(self, locator, locatorType="id"): - try: - element = self.getElement(locator, locatorType) - if element is not None: - self.log.info("Element Found") - return True - else: - self.log.info("Element not found") - return False - except: - print("Element not found") - return False - - def elementPresenceCheck(self, locator, byType): - try: - elementList = self.driver.find_elements(byType, locator) - if len(elementList) > 0: - self.log.info("Element Found") - return True - else: - self.log.info("Element not found") - return False - except: - self.log.info("Element not found") - return False - - def waitForElement(self, locator, locatorType="id", - timeout=10, pollFrequency=0.5): - element = None - try: - byType = self.getByType(locatorType) - self.log.info("Waiting for maximum :: " + str(timeout) + - " :: seconds for element to be clickable") - wait = WebDriverWait(self.driver, 10, poll_frequency=1, - ignored_exceptions=[NoSuchElementException, - ElementNotVisibleException, - ElementNotSelectableException]) - element = wait.until(EC.element_to_be_clickable((byType, - "stopFilter_stops-0"))) - self.log.info("Element appeared on the web page") - except: - self.log.info("Element not appeared on the web page") - print_stack() - return element diff --git a/Python_basics/AutomationFramework_Part_2/170 2-selenium-driver.py b/Python_basics/AutomationFramework_Part_2/170 2-selenium-driver.py deleted file mode 100644 index 0c650a6..0000000 --- a/Python_basics/AutomationFramework_Part_2/170 2-selenium-driver.py +++ /dev/null @@ -1,117 +0,0 @@ -''' -Created on May 30, 2018 -@author: venkateshwara.d -''' -from selenium.webdriver.common.by import By -from traceback import print_stack -from selenium.webdriver.support.ui import WebDriverWait -from selenium.webdriver.support import expected_conditions as EC -from selenium.common.exceptions import * -import utilities.custom_logger as cl -import logging - -class SeleniumDriver(): - - log = cl.customLogger(logging.DEBUG) - - def __init__(self, driver): - self.driver = driver - - def getByType(self, locatorType): - locatorType = locatorType.lower() - if locatorType == "id": - return By.ID - elif locatorType == "name": - return By.NAME - elif locatorType == "xpath": - return By.XPATH - elif locatorType == "css": - return By.CSS_SELECTOR - elif locatorType == "class": - return By.CLASS_NAME - elif locatorType == "link": - return By.LINK_TEXT - else: - self.log.info("Locator type " + locatorType + - " not correct/supported") - return False - - def getElement(self, locator, locatorType="id"): - element = None - try: - locatorType = locatorType.lower() - byType = self.getByType(locatorType) - element = self.driver.find_element(byType, locator) - self.log.info("Element found with locator: " + locator + - " and locatorType: " + locatorType) - except: - self.log.info("Element not found with locator: " + locator + - " and locatorType: " + locatorType) - return element - - def elementClick(self, locator, locatorType="id"): - try: - element = self.getElement(locator, locatorType) - element.click() - self.log.info("Clicked on element with locator: " + locator + - " locatorType: " + locatorType) - except: - self.log.info("Cannot click on the element with locator: " + locator + - " locatorType: " + locatorType) - print_stack() - - def sendKeys(self, data, locator, locatorType="id"): - try: - element = self.getElement(locator, locatorType) - element.send_keys(data) - self.log.info("Sent data on element with locator: " + locator + - " locatorType: " + locatorType) - except: - self.log.info("Cannot send data on the element with locator: " + locator + - " locatorType: " + locatorType) - print_stack() - - def isElementPresent(self, locator, locatorType="id"): - try: - element = self.getElement(locator, locatorType) - if element is not None: - self.log.info("Element Found") - return True - else: - self.log.info("Element not found") - return False - except: - print("Element not found") - return False - - def elementPresenceCheck(self, locator, byType): - try: - elementList = self.driver.find_elements(byType, locator) - if len(elementList) > 0: - self.log.info("Element Found") - return True - else: - self.log.info("Element not found") - return False - except: - self.log.info("Element not found") - return False - - def waitForElement(self, locator, locatorType="id", - timeout=10, pollFrequency=0.5): - element = None - try: - byType = self.getByType(locatorType) - self.log.info("Waiting for maximum :: " + str(timeout) + - " :: seconds for element to be clickable") - wait = WebDriverWait(self.driver, 10, poll_frequency=1, - ignored_exceptions=[NoSuchElementException, - ElementNotVisibleException, - ElementNotSelectableException]) - element = wait.until(EC.element_to_be_clickable((byType, - "stopFilter_stops-0"))) - self.log.info("Element appeared on the web page") - except: - self.log.info("Element not appeared on the web page") - print_stack() - return element diff --git a/Python_basics/AutomationFramework_Part_2/171 3-login-tests.py b/Python_basics/AutomationFramework_Part_2/171 3-login-tests.py deleted file mode 100644 index 2ab51d1..0000000 --- a/Python_basics/AutomationFramework_Part_2/171 3-login-tests.py +++ /dev/null @@ -1,30 +0,0 @@ -''' -Created on May 30, 2018 -@author: venkateshwara.d -''' -from selenium import webdriver -from pages.home.login_page import LoginPage -import unittest -import pytest - -class LoginTests(unittest.TestCase): - baseURL = "https://letskodeit.teachable.com/" - driver = webdriver.Firefox() - driver.maximize_window() - driver.implicitly_wait(3) - lp = LoginPage(driver) - - @pytest.mark.run(order=2) - def test_validLogin(self): - self.lp.clearLoginFields() - self.lp.login("test@email.com", "abcabc") - result = self.lp.verifyLoginSuccessful() - assert result == True - self.driver.quit() - - @pytest.mark.run(order=1) - def test_invalidLogin(self): - self.driver.get(self.baseURL) - self.lp.login("test@email.com", "abcabcabc") - result = self.lp.verifyLoginFailed() - assert result == True diff --git a/Python_basics/AutomationFramework_Part_2/172 4-selenium-driver.py b/Python_basics/AutomationFramework_Part_2/172 4-selenium-driver.py deleted file mode 100644 index 0c650a6..0000000 --- a/Python_basics/AutomationFramework_Part_2/172 4-selenium-driver.py +++ /dev/null @@ -1,117 +0,0 @@ -''' -Created on May 30, 2018 -@author: venkateshwara.d -''' -from selenium.webdriver.common.by import By -from traceback import print_stack -from selenium.webdriver.support.ui import WebDriverWait -from selenium.webdriver.support import expected_conditions as EC -from selenium.common.exceptions import * -import utilities.custom_logger as cl -import logging - -class SeleniumDriver(): - - log = cl.customLogger(logging.DEBUG) - - def __init__(self, driver): - self.driver = driver - - def getByType(self, locatorType): - locatorType = locatorType.lower() - if locatorType == "id": - return By.ID - elif locatorType == "name": - return By.NAME - elif locatorType == "xpath": - return By.XPATH - elif locatorType == "css": - return By.CSS_SELECTOR - elif locatorType == "class": - return By.CLASS_NAME - elif locatorType == "link": - return By.LINK_TEXT - else: - self.log.info("Locator type " + locatorType + - " not correct/supported") - return False - - def getElement(self, locator, locatorType="id"): - element = None - try: - locatorType = locatorType.lower() - byType = self.getByType(locatorType) - element = self.driver.find_element(byType, locator) - self.log.info("Element found with locator: " + locator + - " and locatorType: " + locatorType) - except: - self.log.info("Element not found with locator: " + locator + - " and locatorType: " + locatorType) - return element - - def elementClick(self, locator, locatorType="id"): - try: - element = self.getElement(locator, locatorType) - element.click() - self.log.info("Clicked on element with locator: " + locator + - " locatorType: " + locatorType) - except: - self.log.info("Cannot click on the element with locator: " + locator + - " locatorType: " + locatorType) - print_stack() - - def sendKeys(self, data, locator, locatorType="id"): - try: - element = self.getElement(locator, locatorType) - element.send_keys(data) - self.log.info("Sent data on element with locator: " + locator + - " locatorType: " + locatorType) - except: - self.log.info("Cannot send data on the element with locator: " + locator + - " locatorType: " + locatorType) - print_stack() - - def isElementPresent(self, locator, locatorType="id"): - try: - element = self.getElement(locator, locatorType) - if element is not None: - self.log.info("Element Found") - return True - else: - self.log.info("Element not found") - return False - except: - print("Element not found") - return False - - def elementPresenceCheck(self, locator, byType): - try: - elementList = self.driver.find_elements(byType, locator) - if len(elementList) > 0: - self.log.info("Element Found") - return True - else: - self.log.info("Element not found") - return False - except: - self.log.info("Element not found") - return False - - def waitForElement(self, locator, locatorType="id", - timeout=10, pollFrequency=0.5): - element = None - try: - byType = self.getByType(locatorType) - self.log.info("Waiting for maximum :: " + str(timeout) + - " :: seconds for element to be clickable") - wait = WebDriverWait(self.driver, 10, poll_frequency=1, - ignored_exceptions=[NoSuchElementException, - ElementNotVisibleException, - ElementNotSelectableException]) - element = wait.until(EC.element_to_be_clickable((byType, - "stopFilter_stops-0"))) - self.log.info("Element appeared on the web page") - except: - self.log.info("Element not appeared on the web page") - print_stack() - return element diff --git a/Python_basics/AutomationFramework_Part_2/173 5-webdriverfactory.py b/Python_basics/AutomationFramework_Part_2/173 5-webdriverfactory.py deleted file mode 100644 index 51d385a..0000000 --- a/Python_basics/AutomationFramework_Part_2/173 5-webdriverfactory.py +++ /dev/null @@ -1,58 +0,0 @@ -""" -@package base - -WebDriver Factory class implementation -It creates a webdriver instance based on browser configurations - -Example: - wdf = WebDriverFactory(browser) - wdf.getWebDriverInstance() -""" -import traceback -from selenium import webdriver - -class WebDriverFactory(): - - def __init__(self, browser): - """ - Inits WebDriverFactory class - - Returns: - None - """ - self.browser = browser - """ - Set chrome driver and iexplorer environment based on OS - - chromedriver = "C:/.../chromedriver.exe" - os.environ["webdriver.chrome.driver"] = chromedriver - self.driver = webdriver.Chrome(chromedriver) - - PREFERRED: Set the path on the machine where browser will be executed - """ - - def getWebDriverInstance(self): - """ - Get WebDriver Instance based on the browser configuration - - Returns: - 'WebDriver Instance' - """ - baseURL = "https://letskodeit.teachable.com/" - if self.browser == "iexplorer": - # Set ie driver - driver = webdriver.Ie() - elif self.browser == "firefox": - driver = webdriver.Firefox() - elif self.browser == "chrome": - # Set chrome driver - driver = webdriver.Chrome() - else: - driver = webdriver.Firefox() - # Setting Driver Implicit Time out for An Element - driver.implicitly_wait(3) - # Maximize the window - driver.maximize_window() - # Loading browser with App URL - driver.get(baseURL) - return driver \ No newline at end of file diff --git a/Python_basics/AutomationFramework_Part_2/__init__.py b/Python_basics/AutomationFramework_Part_2/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/Python_basics/AutomationFramework_Part_3/174 1-selenium-driver.py b/Python_basics/AutomationFramework_Part_3/174 1-selenium-driver.py deleted file mode 100644 index 5049faa..0000000 --- a/Python_basics/AutomationFramework_Part_3/174 1-selenium-driver.py +++ /dev/null @@ -1,120 +0,0 @@ -''' -Created on May 30, 2018 -@author: venkateshwara.d -''' -from selenium.webdriver.common.by import By -from traceback import print_stack -from selenium.webdriver.support.ui import WebDriverWait -from selenium.webdriver.support import expected_conditions as EC -from selenium.common.exceptions import * -import utilities.custom_logger as cl -import logging - -class SeleniumDriver(): - - log = cl.customLogger(logging.DEBUG) - - def __init__(self, driver): - self.driver = driver - - def getTitle(self): - return self.driver.title - - def getByType(self, locatorType): - locatorType = locatorType.lower() - if locatorType == "id": - return By.ID - elif locatorType == "name": - return By.NAME - elif locatorType == "xpath": - return By.XPATH - elif locatorType == "css": - return By.CSS_SELECTOR - elif locatorType == "class": - return By.CLASS_NAME - elif locatorType == "link": - return By.LINK_TEXT - else: - self.log.info("Locator type " + locatorType + - " not correct/supported") - return False - - def getElement(self, locator, locatorType="id"): - element = None - try: - locatorType = locatorType.lower() - byType = self.getByType(locatorType) - element = self.driver.find_element(byType, locator) - self.log.info("Element found with locator: " + locator + - " and locatorType: " + locatorType) - except: - self.log.info("Element not found with locator: " + locator + - " and locatorType: " + locatorType) - return element - - def elementClick(self, locator, locatorType="id"): - try: - element = self.getElement(locator, locatorType) - element.click() - self.log.info("Clicked on element with locator: " + locator + - " locatorType: " + locatorType) - except: - self.log.info("Cannot click on the element with locator: " + locator + - " locatorType: " + locatorType) - print_stack() - - def sendKeys(self, data, locator, locatorType="id"): - try: - element = self.getElement(locator, locatorType) - element.send_keys(data) - self.log.info("Sent data on element with locator: " + locator + - " locatorType: " + locatorType) - except: - self.log.info("Cannot send data on the element with locator: " + locator + - " locatorType: " + locatorType) - print_stack() - - def isElementPresent(self, locator, locatorType="id"): - try: - element = self.getElement(locator, locatorType) - if element is not None: - self.log.info("Element Found") - return True - else: - self.log.info("Element not found") - return False - except: - print("Element not found") - return False - - def elementPresenceCheck(self, locator, byType): - try: - elementList = self.driver.find_elements(byType, locator) - if len(elementList) > 0: - self.log.info("Element Found") - return True - else: - self.log.info("Element not found") - return False - except: - self.log.info("Element not found") - return False - - def waitForElement(self, locator, locatorType="id", - timeout=10, pollFrequency=0.5): - element = None - try: - byType = self.getByType(locatorType) - self.log.info("Waiting for maximum :: " + str(timeout) + - " :: seconds for element to be clickable") - wait = WebDriverWait(self.driver, 10, poll_frequency=1, - ignored_exceptions=[NoSuchElementException, - ElementNotVisibleException, - ElementNotSelectableException]) - element = wait.until(EC.element_to_be_clickable((byType, - "stopFilter_stops-0"))) - self.log.info("Element appeared on the web page") - except: - self.log.info("Element not appeared on the web page") - print_stack() - return element diff --git a/Python_basics/AutomationFramework_Part_3/175 2-teststatus.py b/Python_basics/AutomationFramework_Part_3/175 2-teststatus.py deleted file mode 100644 index 57b743d..0000000 --- a/Python_basics/AutomationFramework_Part_3/175 2-teststatus.py +++ /dev/null @@ -1,53 +0,0 @@ -""" -@package utilities - -CheckPoint class implementation -It provides functionality to assert the result - -Example: - self.check_point.markFinal("Test Name", result, "Message") -""" -import utilities.custom_logger as cl -import logging -from base.selenium_driver import SeleniumDriver - -class TestStatus(SeleniumDriver): - - log = cl.customLogger(logging.INFO) - - def __init__(self, driver): - """ - Inits CheckPoint class - """ - super(TestStatus, self).__init__(driver) - self.resultList = [] - - def setResult(self, result, resultMessage): - try: - if result is not None: - if result: - self.resultList.append("PASS") - self.log.info("### VERIFICATION SUCCESSFUL :: + " + resultMessage) - else: - self.resultList.append("FAIL") - self.log.info("### VERIFICATION FAILED :: + " + resultMessage) - else: - self.resultList.append("FAIL") - self.log.info("### VERIFICATION FAILED :: + " + resultMessage) - except: - self.resultList.append("FAIL") - self.log.info("### Exception Occurred !!!") - - def mark(self, result, resultMessage): - """ - Mark the result of the verification point in a test case - """ - self.setResult(result, resultMessage) - - def markFinal(self, testName, result, resultMessage): - """ - Mark the final result of the verification point in a test case - This needs to be called at least once in a test case - This should be final test status of the test case - """ - print() \ No newline at end of file diff --git a/Python_basics/AutomationFramework_Part_3/176 3-teststatus.py b/Python_basics/AutomationFramework_Part_3/176 3-teststatus.py deleted file mode 100644 index 0a9b6a2..0000000 --- a/Python_basics/AutomationFramework_Part_3/176 3-teststatus.py +++ /dev/null @@ -1,62 +0,0 @@ -""" -@package utilities - -CheckPoint class implementation -It provides functionality to assert the result - -Example: - self.check_point.markFinal("Test Name", result, "Message") -""" -import utilities.custom_logger as cl -import logging -from base.selenium_driver import SeleniumDriver - -class TestStatus(SeleniumDriver): - - log = cl.customLogger(logging.INFO) - - def __init__(self, driver): - """ - Inits CheckPoint class - """ - super(TestStatus, self).__init__(driver) - self.resultList = [] - - def setResult(self, result, resultMessage): - try: - if result is not None: - if result: - self.resultList.append("PASS") - self.log.info("### VERIFICATION SUCCESSFUL :: + " + resultMessage) - else: - self.resultList.append("FAIL") - self.log.error("### VERIFICATION FAILED :: + " + resultMessage) - else: - self.resultList.append("FAIL") - self.log.error("### VERIFICATION FAILED :: + " + resultMessage) - except: - self.resultList.append("FAIL") - self.log.error("### Exception Occurred !!!") - - def mark(self, result, resultMessage): - """ - Mark the result of the verification point in a test case - """ - self.setResult(result, resultMessage) - - def markFinal(self, testName, result, resultMessage): - """ - Mark the final result of the verification point in a test case - This needs to be called at least once in a test case - This should be final test status of the test case - """ - self.setResult(result, resultMessage) - - if "FAIL" in self.resultList: - self.log.error(testName + " ### TEST FAILED") - self.resultList.clear() - assert True == False - else: - self.log.info(testName + " ### TEST SUCCESSFUL") - self.resultList.clear() - assert True == True \ No newline at end of file diff --git a/Python_basics/AutomationFramework_Part_3/177 4-selenium-driver.py b/Python_basics/AutomationFramework_Part_3/177 4-selenium-driver.py deleted file mode 100644 index af431c1..0000000 --- a/Python_basics/AutomationFramework_Part_3/177 4-selenium-driver.py +++ /dev/null @@ -1,146 +0,0 @@ -''' -Created on May 30, 2018 -@author: venkateshwara.d -''' -from selenium.webdriver.common.by import By -from traceback import print_stack -from selenium.webdriver.support.ui import WebDriverWait -from selenium.webdriver.support import expected_conditions as EC -from selenium.common.exceptions import * -import utilities.custom_logger as cl -import logging -import time -import os - -class SeleniumDriver(): - - log = cl.customLogger(logging.DEBUG) - - def __init__(self, driver): - self.driver = driver - - def screenShot(self, resultMessage): - """ - Takes screenshot of the current open web page - """ - fileName = resultMessage + "." + str(round(time.time() * 1000)) + ".png" - screenshotDirectory = "../screenshots/" - relativeFileName = screenshotDirectory + fileName - currentDirectory = os.path.dirname(__file__) - destinationFile = os.path.join(currentDirectory, relativeFileName) - destinationDirectory = os.path.join(currentDirectory, screenshotDirectory) - - try: - if not os.path.exists(destinationDirectory): - os.makedirs(destinationDirectory) - self.driver.save_screenshot(destinationFile) - self.log.info("Screenshot save to directory: " + destinationFile) - except: - self.log.error("### Exception Occurred when taking screenshot") - print_stack() - - def getTitle(self): - return self.driver.title - - def getByType(self, locatorType): - locatorType = locatorType.lower() - if locatorType == "id": - return By.ID - elif locatorType == "name": - return By.NAME - elif locatorType == "xpath": - return By.XPATH - elif locatorType == "css": - return By.CSS_SELECTOR - elif locatorType == "class": - return By.CLASS_NAME - elif locatorType == "link": - return By.LINK_TEXT - else: - self.log.info("Locator type " + locatorType + - " not correct/supported") - return False - - def getElement(self, locator, locatorType="id"): - element = None - try: - locatorType = locatorType.lower() - byType = self.getByType(locatorType) - element = self.driver.find_element(byType, locator) - self.log.info("Element found with locator: " + locator + - " and locatorType: " + locatorType) - except: - self.log.info("Element not found with locator: " + locator + - " and locatorType: " + locatorType) - return element - - def elementClick(self, locator, locatorType="id"): - try: - element = self.getElement(locator, locatorType) - element.click() - self.log.info("Clicked on element with locator: " + locator + - " locatorType: " + locatorType) - except: - self.log.info("Cannot click on the element with locator: " + locator + - " locatorType: " + locatorType) - print_stack() - - def sendKeys(self, data, locator, locatorType="id"): - try: - element = self.getElement(locator, locatorType) - element.send_keys(data) - self.log.info("Sent data on element with locator: " + locator + - " locatorType: " + locatorType) - except: - self.log.info("Cannot send data on the element with locator: " + locator + - " locatorType: " + locatorType) - print_stack() - - def isElementPresent(self, locator, locatorType="id"): - try: - element = self.getElement(locator, locatorType) - if element is not None: - self.log.info("Element present with locator: " + locator + - " locatorType: " + locatorType) - return True - else: - self.log.info("Element not present with locator: " + locator + - " locatorType: " + locatorType) - return False - except: - print("Element not found") - return False - - def elementPresenceCheck(self, locator, byType): - try: - elementList = self.driver.find_elements(byType, locator) - if len(elementList) > 0: - self.log.info("Element present with locator: " + locator + - " locatorType: " + str(byType)) - return True - else: - self.log.info("Element not present with locator: " + locator + - " locatorType: " + str(byType)) - return False - except: - self.log.info("Element not found") - return False - - def waitForElement(self, locator, locatorType="id", - timeout=10, pollFrequency=0.5): - element = None - try: - byType = self.getByType(locatorType) - self.log.info("Waiting for maximum :: " + str(timeout) + - " :: seconds for element to be clickable") - wait = WebDriverWait(self.driver, 10, poll_frequency=1, - ignored_exceptions=[NoSuchElementException, - ElementNotVisibleException, - ElementNotSelectableException]) - element = wait.until(EC.element_to_be_clickable((byType, - "stopFilter_stops-0"))) - self.log.info("Element appeared on the web page") - except: - self.log.info("Element not appeared on the web page") - print_stack() - return element diff --git a/Python_basics/AutomationFramework_Part_3/178 5-teststatus.py b/Python_basics/AutomationFramework_Part_3/178 5-teststatus.py deleted file mode 100644 index 2279a67..0000000 --- a/Python_basics/AutomationFramework_Part_3/178 5-teststatus.py +++ /dev/null @@ -1,67 +0,0 @@ -""" -@package utilities - -CheckPoint class implementation -It provides functionality to assert the result - -Example: - self.check_point.markFinal("Test Name", result, "Message") -""" -import utilities.custom_logger as cl -import logging -from base.selenium_driver import SeleniumDriver -from traceback import print_stack - -class TestStatus(SeleniumDriver): - - log = cl.customLogger(logging.INFO) - - def __init__(self, driver): - """ - Inits CheckPoint class - """ - super(TestStatus, self).__init__(driver) - self.resultList = [] - - def setResult(self, result, resultMessage): - try: - if result is not None: - if result: - self.resultList.append("PASS") - self.log.info("### VERIFICATION SUCCESSFUL :: + " + resultMessage) - else: - self.resultList.append("FAIL") - self.log.error("### VERIFICATION FAILED :: + " + resultMessage) - self.screenShot(resultMessage) - else: - self.resultList.append("FAIL") - self.log.error("### VERIFICATION FAILED :: + " + resultMessage) - self.screenShot(resultMessage) - except: - self.resultList.append("FAIL") - self.log.error("### Exception Occurred !!!") - self.screenShot(resultMessage) - print_stack() - - def mark(self, result, resultMessage): - """ - Mark the result of the verification point in a test case - """ - self.setResult(result, resultMessage) - - def markFinal(self, testName, result, resultMessage): - """ - Mark the final result of the verification point in a test case - This needs to be called at least once in a test case - This should be final test status of the test case - """ - self.setResult(result, resultMessage) - - if "FAIL" in self.resultList: - self.log.error(testName + " ### TEST FAILED") - self.resultList.clear() - assert True == False - else: - self.log.info(testName + " ### TEST SUCCESSFUL") - self.resultList.clear() - assert True == True \ No newline at end of file diff --git a/Python_basics/AutomationFramework_Part_3/179 6-util.py b/Python_basics/AutomationFramework_Part_3/179 6-util.py deleted file mode 100644 index 560f669..0000000 --- a/Python_basics/AutomationFramework_Part_3/179 6-util.py +++ /dev/null @@ -1,130 +0,0 @@ -""" -@package utilities - -Util class implementation -All most commonly used utilities should be implemented in this class - -Example: - name = self.util.getUniqueName() -""" -import time -import traceback -import random, string -import utilities.custom_logger as cl -import logging - -class Util(object): - - log = cl.customLogger(logging.INFO) - - def sleep(self, sec, info=""): - """ - Put the program to wait for the specified amount of time - """ - if info is not None: - self.log.info("Wait :: '" + str(sec) + "' seconds for " + info) - try: - time.sleep(sec) - except InterruptedError: - traceback.print_stack() - - def getAlphaNumeric(self, length, type='letters'): - """ - Get random string of characters - - Parameters: - length: Length of string, number of characters string should have - type: Type of characters string should have. Default is letters - Provide lower/upper/digits for different types - """ - alpha_num = '' - if type == 'lower': - case = string.ascii_lowercase - elif type == 'upper': - case = string.ascii_uppercase - elif type == 'digits': - case = string.digits - elif type == 'mix': - case = string.ascii_letters + string.digits - else: - case = string.ascii_letters - return alpha_num.join(random.choice(case) for i in range(length)) - - def getUniqueName(self, charCount=10): - """ - Get a unique name - """ - return self.getAlphaNumeric(charCount, 'lower') - - def getUniqueNameList(self, listSize=5, itemLength=None): - """ - Get a list of valid email ids - - Parameters: - listSize: Number of names. Default is 5 names in a list - itemLength: It should be a list containing number of items equal to the listSize - This determines the length of the each item in the list -> [1, 2, 3, 4, 5] - """ - nameList = [] - for i in range(0, listSize): - nameList.append(self.getUniqueName(itemLength[i])) - return nameList - - def verifyTextContains(self, actualText, expectedText): - """ - Verify actual text contains expected text string - - Parameters: - expectedList: Expected Text - actualList: Actual Text - """ - self.log.info("Actual Text From Application Web UI --> :: " + actualText) - self.log.info("Expected Text From Application Web UI --> :: " + expectedText) - if expectedText.lower() in actualText.lower(): - self.log.info("### VERIFICATION CONTAINS !!!") - return True - else: - self.log.info("### VERIFICATION DOES NOT CONTAINS !!!") - return False - - def verifyTextMatch(self, actualText, expectedText): - """ - Verify text match - - Parameters: - expectedList: Expected Text - actualList: Actual Text - """ - self.log.info("Actual Text From Application Web UI --> :: " + actualText) - self.log.info("Expected Text From Application Web UI --> :: " + expectedText) - if actualText.lower() == expectedText.lower(): - self.log.info("### VERIFICATION MATCHED !!!") - return True - else: - self.log.info("### VERIFICATION DOES NOT MATCHED !!!") - return False - - def verifyListMatch(self, expectedList, actualList): - """ - Verify two list matches - - Parameters: - expectedList: Expected List - actualList: Actual List - """ - return set(expectedList) == set(actualList) - - def verifyListContains(self, expectedList, actualList): - """ - Verify actual list contains elements of expected list - - Parameters: - expectedList: Expected List - actualList: Actual List - """ - length = len(expectedList) - for i in range(0, length): - if expectedList[i] not in actualList: - return False - else: - return True \ No newline at end of file diff --git a/Python_basics/AutomationFramework_Part_3/180 7-util.py b/Python_basics/AutomationFramework_Part_3/180 7-util.py deleted file mode 100644 index 560f669..0000000 --- a/Python_basics/AutomationFramework_Part_3/180 7-util.py +++ /dev/null @@ -1,130 +0,0 @@ -""" -@package utilities - -Util class implementation -All most commonly used utilities should be implemented in this class - -Example: - name = self.util.getUniqueName() -""" -import time -import traceback -import random, string -import utilities.custom_logger as cl -import logging - -class Util(object): - - log = cl.customLogger(logging.INFO) - - def sleep(self, sec, info=""): - """ - Put the program to wait for the specified amount of time - """ - if info is not None: - self.log.info("Wait :: '" + str(sec) + "' seconds for " + info) - try: - time.sleep(sec) - except InterruptedError: - traceback.print_stack() - - def getAlphaNumeric(self, length, type='letters'): - """ - Get random string of characters - - Parameters: - length: Length of string, number of characters string should have - type: Type of characters string should have. Default is letters - Provide lower/upper/digits for different types - """ - alpha_num = '' - if type == 'lower': - case = string.ascii_lowercase - elif type == 'upper': - case = string.ascii_uppercase - elif type == 'digits': - case = string.digits - elif type == 'mix': - case = string.ascii_letters + string.digits - else: - case = string.ascii_letters - return alpha_num.join(random.choice(case) for i in range(length)) - - def getUniqueName(self, charCount=10): - """ - Get a unique name - """ - return self.getAlphaNumeric(charCount, 'lower') - - def getUniqueNameList(self, listSize=5, itemLength=None): - """ - Get a list of valid email ids - - Parameters: - listSize: Number of names. Default is 5 names in a list - itemLength: It should be a list containing number of items equal to the listSize - This determines the length of the each item in the list -> [1, 2, 3, 4, 5] - """ - nameList = [] - for i in range(0, listSize): - nameList.append(self.getUniqueName(itemLength[i])) - return nameList - - def verifyTextContains(self, actualText, expectedText): - """ - Verify actual text contains expected text string - - Parameters: - expectedList: Expected Text - actualList: Actual Text - """ - self.log.info("Actual Text From Application Web UI --> :: " + actualText) - self.log.info("Expected Text From Application Web UI --> :: " + expectedText) - if expectedText.lower() in actualText.lower(): - self.log.info("### VERIFICATION CONTAINS !!!") - return True - else: - self.log.info("### VERIFICATION DOES NOT CONTAINS !!!") - return False - - def verifyTextMatch(self, actualText, expectedText): - """ - Verify text match - - Parameters: - expectedList: Expected Text - actualList: Actual Text - """ - self.log.info("Actual Text From Application Web UI --> :: " + actualText) - self.log.info("Expected Text From Application Web UI --> :: " + expectedText) - if actualText.lower() == expectedText.lower(): - self.log.info("### VERIFICATION MATCHED !!!") - return True - else: - self.log.info("### VERIFICATION DOES NOT MATCHED !!!") - return False - - def verifyListMatch(self, expectedList, actualList): - """ - Verify two list matches - - Parameters: - expectedList: Expected List - actualList: Actual List - """ - return set(expectedList) == set(actualList) - - def verifyListContains(self, expectedList, actualList): - """ - Verify actual list contains elements of expected list - - Parameters: - expectedList: Expected List - actualList: Actual List - """ - length = len(expectedList) - for i in range(0, length): - if expectedList[i] not in actualList: - return False - else: - return True \ No newline at end of file diff --git a/Python_basics/AutomationFramework_Part_3/__init__.py b/Python_basics/AutomationFramework_Part_3/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/Python_basics/AutomationFramework_Part_4/181 1-selenium-driver.py b/Python_basics/AutomationFramework_Part_4/181 1-selenium-driver.py deleted file mode 100644 index 5503e55..0000000 --- a/Python_basics/AutomationFramework_Part_4/181 1-selenium-driver.py +++ /dev/null @@ -1,240 +0,0 @@ -''' -Created on May 30, 2018 -@author: venkateshwara.d -''' -from selenium.webdriver.common.by import By -from traceback import print_stack -from selenium.webdriver.support.ui import WebDriverWait -from selenium.webdriver.support import expected_conditions as EC -from selenium.common.exceptions import * -import utilities.custom_logger as cl -import logging -import time -import os - -class SeleniumDriver(): - - log = cl.customLogger(logging.DEBUG) - - def __init__(self, driver): - self.driver = driver - - def screenShot(self, resultMessage): - """ - Takes screenshot of the current open web page - """ - fileName = resultMessage + "." + str(round(time.time() * 1000)) + ".png" - screenshotDirectory = "../screenshots/" - relativeFileName = screenshotDirectory + fileName - currentDirectory = os.path.dirname(__file__) - destinationFile = os.path.join(currentDirectory, relativeFileName) - destinationDirectory = os.path.join(currentDirectory, screenshotDirectory) - - try: - if not os.path.exists(destinationDirectory): - os.makedirs(destinationDirectory) - self.driver.save_screenshot(destinationFile) - self.log.info("Screenshot save to directory: " + destinationFile) - except: - self.log.error("### Exception Occurred when taking screenshot") - print_stack() - - def getTitle(self): - return self.driver.title - - def getByType(self, locatorType): - locatorType = locatorType.lower() - if locatorType == "id": - return By.ID - elif locatorType == "name": - return By.NAME - elif locatorType == "xpath": - return By.XPATH - elif locatorType == "css": - return By.CSS_SELECTOR - elif locatorType == "class": - return By.CLASS_NAME - elif locatorType == "link": - return By.LINK_TEXT - else: - self.log.info("Locator type " + locatorType + - " not correct/supported") - return False - - def getElement(self, locator, locatorType="id"): - element = None - try: - locatorType = locatorType.lower() - byType = self.getByType(locatorType) - element = self.driver.find_element(byType, locator) - self.log.info("Element found with locator: " + locator + - " and locatorType: " + locatorType) - except: - self.log.info("Element not found with locator: " + locator + - " and locatorType: " + locatorType) - return element - - def getElementList(self, locator, locatorType="id"): - """ - NEW METHOD - Get list of elements - """ - element = None - try: - locatorType = locatorType.lower() - byType = self.getByType(locatorType) - element = self.driver.find_elements(byType, locator) - self.log.info("Element list found with locator: " + locator + - " and locatorType: " + locatorType) - except: - self.log.info("Element list not found with locator: " + locator + - " and locatorType: " + locatorType) - return element - - def elementClick(self, locator="", locatorType="id", element=None): - """ - Click on an element -> MODIFIED - Either provide element or a combination of locator and locatorType - """ - try: - if locator: # This means if locator is not empty - element = self.getElement(locator, locatorType) - element.click() - self.log.info("Clicked on element with locator: " + locator + - " locatorType: " + locatorType) - except: - self.log.info("Cannot click on the element with locator: " + locator + - " locatorType: " + locatorType) - print_stack() - - def sendKeys(self, data, locator="", locatorType="id", element=None): - """ - Send keys to an element -> MODIFIED - Either provide element or a combination of locator and locatorType - """ - try: - if locator: # This means if locator is not empty - element = self.getElement(locator, locatorType) - element.send_keys(data) - self.log.info("Sent data on element with locator: " + locator + - " locatorType: " + locatorType) - except: - self.log.info("Cannot send data on the element with locator: " + locator + - " locatorType: " + locatorType) - print_stack() - - def getText(self, locator="", locatorType="id", element=None, info=""): - """ - NEW METHOD - Get 'Text' on an element - Either provide element or a combination of locator and locatorType - """ - try: - if locator: # This means if locator is not empty - self.log.debug("In locator condition") - element = self.getElement(locator, locatorType) - self.log.debug("Before finding text") - text = element.text - self.log.debug("After finding element, size is: " + str(len(text))) - if len(text) == 0: - text = element.get_attribute("innerText") - if len(text) != 0: - self.log.info("Getting text on element :: " + info) - self.log.info("The text is :: '" + text + "'") - text = text.strip() - except: - self.log.error("Failed to get text on element " + info) - print_stack() - text = None - return text - - def isElementPresent(self, locator="", locatorType="id", element=None): - """ - Check if element is present -> MODIFIED - Either provide element or a combination of locator and locatorType - """ - try: - if locator: # This means if locator is not empty - element = self.getElement(locator, locatorType) - if element is not None: - self.log.info("Element present with locator: " + locator + - " locatorType: " + locatorType) - return True - else: - self.log.info("Element not present with locator: " + locator + - " locatorType: " + locatorType) - return False - except: - print("Element not found") - return False - - def isElementDisplayed(self, locator="", locatorType="id", element=None): - """ - NEW METHOD - Check if element is displayed - Either provide element or a combination of locator and locatorType - """ - isDisplayed = False - try: - if locator: # This means if locator is not empty - element = self.getElement(locator, locatorType) - if element is not None: - isDisplayed = element.is_displayed() - self.log.info("Element is displayed with locator: " + locator + - " locatorType: " + locatorType) - else: - self.log.info("Element not displayed with locator: " + locator + - " locatorType: " + locatorType) - return isDisplayed - except: - print("Element not found") - return False - - def elementPresenceCheck(self, locator, byType): - """ - Check if element is present - """ - try: - elementList = self.driver.find_elements(byType, locator) - if len(elementList) > 0: - self.log.info("Element present with locator: " + locator + - " locatorType: " + str(byType)) - return True - else: - self.log.info("Element not present with locator: " + locator + - " locatorType: " + str(byType)) - return False - except: - self.log.info("Element not found") - return False - - def waitForElement(self, locator, locatorType="id", - timeout=10, pollFrequency=0.5): - element = None - try: - byType = self.getByType(locatorType) - self.log.info("Waiting for maximum :: " + str(timeout) + - " :: seconds for element to be clickable") - wait = WebDriverWait(self.driver, timeout=timeout, - poll_frequency=pollFrequency, - ignored_exceptions=[NoSuchElementException, - ElementNotVisibleException, - ElementNotSelectableException]) - element = wait.until(EC.element_to_be_clickable((byType, locator))) - self.log.info("Element appeared on the web page") - except: - self.log.info("Element not appeared on the web page") - print_stack() - return element - - def webScroll(self, direction="up"): - """ - NEW METHOD - """ - if direction == "up": - # Scroll Up - self.driver.execute_script("window.scrollBy(0, -1000);") - - if direction == "down": - # Scroll Down - self.driver.execute_script("window.scrollBy(0, 1000);") diff --git a/Python_basics/AutomationFramework_Part_4/183 3-register-courses-pages.py b/Python_basics/AutomationFramework_Part_4/183 3-register-courses-pages.py deleted file mode 100644 index cacac1c..0000000 --- a/Python_basics/AutomationFramework_Part_4/183 3-register-courses-pages.py +++ /dev/null @@ -1,62 +0,0 @@ -''' -Created on May 30, 2018 -@author: venkateshwara.d -''' -import utilities.custom_logger as cl -import logging -from base.basepage import BasePage - -class RegisterCoursesPage(BasePage): - - log = cl.customLogger(logging.DEBUG) - - def __init__(self, driver): - super().__init__(driver) - self.driver = driver - - ################ - ### Locators ### - ################ - _search_box = "search-courses" - _course = "//div[contains(@class,'course-listing-title') and contains(text(),'{0}')]" - _all_courses = "course-listing-title" - _enroll_button = "enroll-button-top" - _cc_num = "cc_field" - _cc_exp = "cc-exp" - _cc_cvv = "cc_cvc" - _submit_enroll = "//div[@id='new_card']//button[contains(text(),'Enroll in Course')]" - _enroll_error_message = "//div[@id='new_card']//div[contains(text(),'The card number is not a valid credit card number.')]" - - ############################ - ### Element Interactions ### - ############################ - - def enterCourseName(self, name): - print() - - def selectCourseToEnroll(self, fullCourseName): - print() - - def clickOnEnrollButton(self): - print() - - def enterCardNum(self, num): - print() - - def enterCardExp(self, exp): - print() - - def enterCardCVV(self, cvv): - print() - - def clickEnrollSubmitButton(self): - print() - - def enterCreditCardInformation(self, num, exp, cvv): - print() - - def enrollCourse(self, num="", exp="", cvv=""): - print() - - def verifyEnrollFailed(self): - print() diff --git a/Python_basics/AutomationFramework_Part_4/184 4-register-courses-pages.py b/Python_basics/AutomationFramework_Part_4/184 4-register-courses-pages.py deleted file mode 100644 index 6c20744..0000000 --- a/Python_basics/AutomationFramework_Part_4/184 4-register-courses-pages.py +++ /dev/null @@ -1,69 +0,0 @@ -''' -Created on May 30, 2018 -@author: venkateshwara.d -''' -import utilities.custom_logger as cl -import logging -from base.basepage import BasePage - -class RegisterCoursesPage(BasePage): - - log = cl.customLogger(logging.DEBUG) - - def __init__(self, driver): - super().__init__(driver) - self.driver = driver - - ################ - ### Locators ### - ################ - _search_box = "search-courses" - _course = "//div[contains(@class,'course-listing-title') and contains(text(),'{0}')]" - _all_courses = "course-listing-title" - _enroll_button = "enroll-button-top" - _cc_num = "cc_field" - _cc_exp = "cc-exp" - _cc_cvv = "cc_cvc" - _submit_enroll = "//div[@id='new_card']//button[contains(text(),'Enroll in Course')]" - _enroll_error_message = "//div[@id='new_card']//div[contains(text(),'The card number is not a valid credit card number.')]" - - ############################ - ### Element Interactions ### - ############################ - - def enterCourseName(self, name): - self.sendKeys(name, locator=self._search_box) - - def selectCourseToEnroll(self, fullCourseName): - self.elementClick(locator=self._course.format(fullCourseName), locatorType="xpath") - - def clickOnEnrollButton(self): - self.elementClick(locator=self._enroll_button) - - def enterCardNum(self, num): - self.sendKeys(num, locator=self._cc_num) - - def enterCardExp(self, exp): - self.sendKeys(exp, locator=self._cc_exp) - - def enterCardCVV(self, cvv): - self.sendKeys(cvv, locator=self._cc_cvv) - - def clickEnrollSubmitButton(self): - self.sendKeys(self._submit_enroll, locator="xpath") - - def enterCreditCardInformation(self, num, exp, cvv): - self.enterCardNum(num) - self.enterCardExp(exp) - self.enterCardCVV(cvv) - - def enrollCourse(self, num="", exp="", cvv=""): - self.clickOnEnrollButton() - self.webScroll(direction="down") - self.enterCreditCardInformation(num, exp, cvv) - self.clickEnrollSubmitButton() - - def verifyEnrollFailed(self): - messageElement = self.waitForElement(self._enroll_error_message, locatorType="xpath") - result = self.isElementDisplayed(element=messageElement) - return result diff --git a/Python_basics/AutomationFramework_Part_4/185 5-register-courses-tests.py b/Python_basics/AutomationFramework_Part_4/185 5-register-courses-tests.py deleted file mode 100644 index 12dd831..0000000 --- a/Python_basics/AutomationFramework_Part_4/185 5-register-courses-tests.py +++ /dev/null @@ -1,25 +0,0 @@ -''' -Created on May 30, 2018 -@author: venkateshwara.d -''' -from pages.courses.register_courses_page import RegisterCoursesPage -from utilities.teststatus import TestStatus -import unittest -import pytest - -@pytest.mark.usefixtures("oneTimeSetUp", "setUp") -class RegisterCoursesTests(unittest.TestCase): - - @pytest.fixture(autouse=True) - def objectSetup(self, oneTimeSetUp): - self.courses = RegisterCoursesPage(self.driver) - self.ts = TestStatus(self.driver) - - @pytest.mark.run(order=1) - def test_invalidEnrollment(self): - self.courses.enterCourseName("JavaScript") - self.courses.selectCourseToEnroll("JavaScript for beginners") - self.courses.enrollCourse(num="10", exp="1220", cvv="10") - result = self.courses.verifyEnrollFailed() - self.ts.markFinal("test_invalidEnrollment", result, - "Enrollment Failed Verification") diff --git a/Python_basics/AutomationFramework_Part_4/__init__.py b/Python_basics/AutomationFramework_Part_4/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/Python_basics/ComparisonAndBooleanOperators/028 comparators.py b/Python_basics/ComparisonAndBooleanOperators/028 comparators.py deleted file mode 100644 index 1dbc3d0..0000000 --- a/Python_basics/ComparisonAndBooleanOperators/028 comparators.py +++ /dev/null @@ -1,16 +0,0 @@ -""" -== --> Value Equality -!= --> Not equal to -< --> Less than -> --> Greater than -<= --> Less than or equal to ->= --> Greater than or equal to -""" - -bool_one = 10 == 11 -not_equal = 10 != 11 -less_than = 10 < 11 -greater_than = 10 > 9 -lt_eq = 10 <= 10 -gt_eq = 10 >= 11 - 1 -print (gt_eq) \ No newline at end of file diff --git a/Python_basics/ComparisonAndBooleanOperators/029 boolean-opertors.py b/Python_basics/ComparisonAndBooleanOperators/029 boolean-opertors.py deleted file mode 100644 index eed8b01..0000000 --- a/Python_basics/ComparisonAndBooleanOperators/029 boolean-opertors.py +++ /dev/null @@ -1,33 +0,0 @@ -""" -and -************************************** -True and True --> True -True and False --> False -False and False --> False -************************************** - -or -************************************** -True or True --> True -True or False --> True -False or False --> False -************************************** - -not -************************************** -Not True --> False -Not False --> True -""" - -and_output1 = (10 == 10) and (10 > 9) -and_output2 = (10 == 10) and (10 < 9) -and_output3 = (10 > 10) and (10 < 9) - -or_output1 = (10 == 10) or (10 > 9) -or_output2 = (10 == 10) or (10 < 9) -or_output3 = (10 > 10) or (10 < 9) - -not_true = not (10 == 10) -not_false = not (10 > 10) - -print(not_false) \ No newline at end of file diff --git a/Python_basics/ComparisonAndBooleanOperators/030 boolean-precedence.py b/Python_basics/ComparisonAndBooleanOperators/030 boolean-precedence.py deleted file mode 100644 index 84aec2f..0000000 --- a/Python_basics/ComparisonAndBooleanOperators/030 boolean-precedence.py +++ /dev/null @@ -1,13 +0,0 @@ -""" -1. not -2. and -3. or -""" - -bool_output = True or not False and False -# True -print(bool_output) - -bool_output_1 = (10 == 10 or not 10 > 10) and 10 > 10 -# True or True -> True and False -> False -print(bool_output_1) \ No newline at end of file diff --git a/Python_basics/ComparisonAndBooleanOperators/__init__.py b/Python_basics/ComparisonAndBooleanOperators/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/Python_basics/Data_Driven_Testing/187 2-register-courses-multiple-data-set.py b/Python_basics/Data_Driven_Testing/187 2-register-courses-multiple-data-set.py deleted file mode 100644 index 73ec676..0000000 --- a/Python_basics/Data_Driven_Testing/187 2-register-courses-multiple-data-set.py +++ /dev/null @@ -1,29 +0,0 @@ -''' -Created on May 30, 2018 -@author: venkateshwara.d -''' -from pages.courses.register_courses_page import RegisterCoursesPage -from utilities.teststatus import TestStatus -import unittest, pytest -from ddt import ddt, data, unpack - -@pytest.mark.usefixtures("oneTimeSetUp", "setUp") -@ddt -class RegisterMultipleCoursesTests(unittest.TestCase): - - @pytest.fixture(autouse=True) - def objectSetup(self, oneTimeSetUp): - self.courses = RegisterCoursesPage(self.driver) - self.ts = TestStatus(self.driver) - - @pytest.mark.run(order=1) - @data(("JavaScript for beginners", "10", "1220", "10"), ("Learn Python 3 from scratch", "20", "1220", "20")) - @unpack - def test_invalidEnrollment(self, courseName, ccNum, ccExp, ccCVV): - self.courses.enterCourseName(courseName) - self.courses.selectCourseToEnroll(courseName) - self.courses.enrollCourse(num=ccNum, exp=ccExp, cvv=ccCVV) - result = self.courses.verifyEnrollFailed() - self.ts.markFinal("test_invalidEnrollment", result, - "Enrollment Failed Verification") - self.driver.find_element_by_link_text("All Courses").click() diff --git a/Python_basics/Data_Driven_Testing/188 3-read-data.py b/Python_basics/Data_Driven_Testing/188 3-read-data.py deleted file mode 100644 index 37e7e9b..0000000 --- a/Python_basics/Data_Driven_Testing/188 3-read-data.py +++ /dev/null @@ -1,18 +0,0 @@ -''' -Created on May 30, 2018 -@author: venkateshwara.d -''' -import csv -def getCSVData(fileName): - # create an empty list to store rows - rows = [] - # open the CSV file - dataFile = open(fileName, "r") - # create a CSV Reader from CSV file - reader = csv.reader(dataFile) - # skip the headers - next(reader) - # add rows from reader to list - for row in reader: - rows.append(row) - return rows diff --git a/Python_basics/Data_Driven_Testing/189 testdata.csv b/Python_basics/Data_Driven_Testing/189 testdata.csv deleted file mode 100644 index f1d1ead..0000000 --- a/Python_basics/Data_Driven_Testing/189 testdata.csv +++ /dev/null @@ -1,3 +0,0 @@ -courseName,ccNum,ccExp,ccCVV -JavaScript for beginners,10,1220,10 -Learn Python 3 from scratch,20,1220,20 \ No newline at end of file diff --git a/Python_basics/Data_Driven_Testing/__init__.py b/Python_basics/Data_Driven_Testing/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/Python_basics/Drivers/chromedriver.exe b/Python_basics/Drivers/chromedriver.exe deleted file mode 100644 index 793444e..0000000 Binary files a/Python_basics/Drivers/chromedriver.exe and /dev/null differ diff --git a/Python_basics/Drivers/geckodriver.exe b/Python_basics/Drivers/geckodriver.exe deleted file mode 100644 index 6026549..0000000 Binary files a/Python_basics/Drivers/geckodriver.exe and /dev/null differ diff --git a/Python_basics/Exceptionhandling/049 exceptionhandling1.py b/Python_basics/Exceptionhandling/049 exceptionhandling1.py deleted file mode 100644 index 9d7d2d0..0000000 --- a/Python_basics/Exceptionhandling/049 exceptionhandling1.py +++ /dev/null @@ -1,23 +0,0 @@ -""" -Exceptions are errors -We should handle exceptions in our code -to make sure the code is working the way we want and is handling all the unwanted issues -Link to 3.5 built-in exceptions - https://docs.python.org/3/library/exceptions.html -""" - -def exceptionHandling(): - try: - a = 10 - b = 20 - c = 0 - - d = (a + b) / c - print(d) - # except ZeroDivisionError: - # print("Zero Division") - # except TypeError: - # print("Can't add string to integer") - except: - print("In the except block") - -exceptionHandling() \ No newline at end of file diff --git a/Python_basics/Exceptionhandling/050 exceptionhandling2.py b/Python_basics/Exceptionhandling/050 exceptionhandling2.py deleted file mode 100644 index cc0c3ea..0000000 --- a/Python_basics/Exceptionhandling/050 exceptionhandling2.py +++ /dev/null @@ -1,20 +0,0 @@ -""" -Exceptions are errors -""" - -def exceptionHandling(): - try: - a = 10 - b = 20 - c = 0 - - d = (a + b) / c - print(d) - except: - print("In the except block") - else: - print("Because there was no exception, else is executed") - finally: - print("Finally, always executed") - -exceptionHandling() \ No newline at end of file diff --git a/Python_basics/Exceptionhandling/051 exceptionHandlingHomework.py b/Python_basics/Exceptionhandling/051 exceptionHandlingHomework.py deleted file mode 100644 index d33c153..0000000 --- a/Python_basics/Exceptionhandling/051 exceptionHandlingHomework.py +++ /dev/null @@ -1,14 +0,0 @@ -''' -Created on May 30, 2018 -@author: venkateshwara.d -''' -def exceptionHandling(): - try: - car = {"make": "bmw", "model": "550i", "year": "2016"} - print(car["color"]) - except: - print("Key not found") - finally: - print("Please try a different key") - -exceptionHandling() diff --git a/Python_basics/Exceptionhandling/__init__.py b/Python_basics/Exceptionhandling/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/Python_basics/LaunchBrowsers/AllLinks.py b/Python_basics/LaunchBrowsers/AllLinks.py deleted file mode 100644 index 33e31e5..0000000 --- a/Python_basics/LaunchBrowsers/AllLinks.py +++ /dev/null @@ -1,17 +0,0 @@ -''' -Created on May 21, 2018 - -@author: venkateshwara.d -''' -import os -from selenium import webdriver - -chrome_driver_path = os.path.dirname(__file__) + "\chromedriver.exe" - -driver=webdriver.Chrome(chrome_driver_path) - -driver.get('https://www.w3.org/') -for a in driver.find_elements_by_xpath('.//a'): - print(a.get_attribute('href')) - -driver.close() diff --git a/Python_basics/LaunchBrowsers/GetImageIinks.py b/Python_basics/LaunchBrowsers/GetImageIinks.py deleted file mode 100644 index a8f7ef7..0000000 --- a/Python_basics/LaunchBrowsers/GetImageIinks.py +++ /dev/null @@ -1,22 +0,0 @@ -''' -Created on May 21, 2018 - -@author: venkateshwara.d -''' -import os -from selenium import webdriver - -chrome_driver_path = os.path.dirname(__file__) + "\chromedriver.exe" - -driver=webdriver.Chrome(chrome_driver_path) -driver.get('http://imgur.com/') - -images = driver.find_elements_by_tag_name('img') - - -for image in images: - print(image.get_attribute('src')) - - -driver.close() - diff --git a/Python_basics/LaunchBrowsers/HeadlessBrowser.py b/Python_basics/LaunchBrowsers/HeadlessBrowser.py deleted file mode 100644 index 8abba8d..0000000 --- a/Python_basics/LaunchBrowsers/HeadlessBrowser.py +++ /dev/null @@ -1,34 +0,0 @@ -''' -Created on May 21, 2018 - -@author: venkateshwara.d -''' -import os -from selenium import webdriver -from selenium.webdriver.chrome.options import Options - -chrome_driver_path = os.path.dirname(__file__) + "\chromedriver.exe" - - -chrome_options = Options() -chrome_options.add_argument("--headless") -chrome_options.add_argument("--window-size=1920x1080") - -# download the chrome driver from https://sites.google.com/a/chromium.org/chromedriver/downloads and put it in the -# current directory - - -# go to Google and click the I'm Feeling Lucky button -driver = webdriver.Chrome(chrome_options=chrome_options, executable_path=chrome_driver_path) -driver.get("https://www.google.com") -lucky_button = driver.find_element_by_css_selector("[name=btnI]") -lucky_button.click() - -# capture the screen -driver.get_screenshot_as_file("capture.png") - -driver.close() - - - - diff --git a/Python_basics/LaunchBrowsers/Save_screenshot.py b/Python_basics/LaunchBrowsers/Save_screenshot.py deleted file mode 100644 index 853f135..0000000 --- a/Python_basics/LaunchBrowsers/Save_screenshot.py +++ /dev/null @@ -1,16 +0,0 @@ -''' -Created on May 21, 2018 - -@author: venkateshwara.d -''' - -import os -from selenium import webdriver - -chrome_driver_path = os.path.dirname(__file__) + "\chromedriver.exe" - -driver=webdriver.Chrome(chrome_driver_path) -driver.get('https://python.org') -driver.save_screenshot("capture.png") - -driver.close() \ No newline at end of file diff --git a/Python_basics/LaunchBrowsers/SeleniumClickButton.py b/Python_basics/LaunchBrowsers/SeleniumClickButton.py deleted file mode 100644 index f6f184c..0000000 --- a/Python_basics/LaunchBrowsers/SeleniumClickButton.py +++ /dev/null @@ -1,32 +0,0 @@ -''' -Created on May 21, 2018 - -@author: venkateshwara.d -''' -import os -from selenium import webdriver -import time - -chrome_driver_path = os.path.dirname(__file__) + "\chromedriver.exe" - -driver=webdriver.Chrome(chrome_driver_path) -driver.get('http://codepad.org') - -# click radio button -python_button = driver.find_elements_by_xpath("//input[@name='lang' and @value='Python']")[0] -python_button.click() - -# type text -text_area = driver.find_element_by_id('textarea') -time.sleep(3) - -text_area.clear() - -text_area.send_keys("print('Hello World')") - -# click submit button -submit_button = driver.find_element_by_css_selector(".g-recaptcha") -submit_button.click() - -driver.close() - diff --git a/Python_basics/LaunchBrowsers/WriteDataToTxt.py b/Python_basics/LaunchBrowsers/WriteDataToTxt.py deleted file mode 100644 index 6414890..0000000 --- a/Python_basics/LaunchBrowsers/WriteDataToTxt.py +++ /dev/null @@ -1,25 +0,0 @@ -''' -Created on May 21, 2018 - -@author: venkateshwara.d -''' -import os -from selenium import webdriver -import io - -chrome_driver_path = os.path.abspath('..') + "\\Drivers\\chromedriver.exe" - -driver=webdriver.Chrome(chrome_driver_path) - -driver.get('https://python.org') - -html = driver.page_source - -if(os.path.isfile("pageSource.txt")): - - os.remove("pageSource.txt") - -with io.FileIO("pageSource.txt", "w") as file: - file.write(html.encode("utf-8")) - -driver.close() \ No newline at end of file diff --git a/Python_basics/LaunchBrowsers/__init__.py b/Python_basics/LaunchBrowsers/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/Python_basics/LaunchBrowsers/interactingWithPage.py b/Python_basics/LaunchBrowsers/interactingWithPage.py deleted file mode 100644 index b0fc3cd..0000000 --- a/Python_basics/LaunchBrowsers/interactingWithPage.py +++ /dev/null @@ -1,29 +0,0 @@ -''' -Created on May 30, 2018 -@author: venkateshwara.d -''' -import os -from selenium import webdriver - -chrome_driver_path = os.path.dirname(__file__) + "\chromedriver.exe" - -driver=webdriver.Chrome(chrome_driver_path) - -driver.get('http://codepad.org') - -text_area = driver.find_element_by_id('textarea') -text_area.send_keys("This text is send using Python code.") - -text = driver.find_element_by_xpath("//*[@id='editor-form']/table/tbody/tr[1]/td/span").text -print(text) - -print (driver.current_url) - -driver.close() -#driver.forward() -#driver.back() -#driver.minimize_window() -#driver.maximize_window() -#driver.refresh() -#driver.set_page_load_timeout(20)#seconds -#driver.delete_all_cookies() diff --git a/Python_basics/Logging_infrastructure/137 logging-demo1.py b/Python_basics/Logging_infrastructure/137 logging-demo1.py deleted file mode 100644 index 967b911..0000000 --- a/Python_basics/Logging_infrastructure/137 logging-demo1.py +++ /dev/null @@ -1,15 +0,0 @@ -""" -Logging Demo 1 -Logging Levels -DEBUG -INFO -WARNING -ERROR -CRITICAL -""" -import logging - -logging.basicConfig(filename="test.log", level=logging.DEBUG) -logging.warning("warning message") -logging.info("info message") -logging.error("error message") \ No newline at end of file diff --git a/Python_basics/Logging_infrastructure/138 logging-format.py b/Python_basics/Logging_infrastructure/138 logging-format.py deleted file mode 100644 index 57cdd1a..0000000 --- a/Python_basics/Logging_infrastructure/138 logging-format.py +++ /dev/null @@ -1,12 +0,0 @@ -""" -Logging Format -https://docs.python.org/3/library/logging.html#logrecord-attributes -https://docs.python.org/3/library/time.html#time.strftime -""" -import logging - -logging.basicConfig(format='%(asctime)s: %(levelname)s: %(message)s', - datefmt='%m/%d/%Y %I:%M:%S %p',level=logging.DEBUG) -logging.warning("warning message") -logging.info("info message") -logging.error("error message") \ No newline at end of file diff --git a/Python_basics/Logging_infrastructure/139 logger-demo-console.py b/Python_basics/Logging_infrastructure/139 logger-demo-console.py deleted file mode 100644 index 6ab3978..0000000 --- a/Python_basics/Logging_infrastructure/139 logger-demo-console.py +++ /dev/null @@ -1,35 +0,0 @@ -""" -Logger Demo -""" -import logging - -class LoggerDemoConsole(): - - def testLog(self): - # create logger - logger = logging.getLogger(LoggerDemoConsole.__name__) - logger.setLevel(logging.INFO) - - # create console handler and set level to info - consoleHandler = logging.StreamHandler() - consoleHandler.setLevel(logging.INFO) - - # create formatter - formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s: %(message)s', - datefmt='%m/%d/%Y %I:%M:%S %p') - - # add formatter to console handler - consoleHandler.setFormatter(formatter) - - # add console handler to logger - logger.addHandler(consoleHandler) - - # logging messages - logger.debug('debug message') - logger.info('info message') - logger.warn('warn message') - logger.error('error message') - logger.critical('critical message') - -demo = LoggerDemoConsole() -demo.testLog() \ No newline at end of file diff --git a/Python_basics/Logging_infrastructure/140 logging.txt b/Python_basics/Logging_infrastructure/140 logging.txt deleted file mode 100644 index da996fb..0000000 --- a/Python_basics/Logging_infrastructure/140 logging.txt +++ /dev/null @@ -1,31 +0,0 @@ -Please change the extension of this file to .conf and then use it -Please also delete these line before using the file -Udemy does not allow to upload .conf files, this is why I had to change the extension to .txt -[loggers] -keys=root,LoggerDemoConf - -[handlers] -keys=fileHandler - -[formatters] -keys=simpleFormatter - -[logger_root] -level=DEBUG -handlers=fileHandler - -[logger_LoggerDemoConf] -level=INFO -handlers=fileHandler -qualname=demoLogger -propagate=0 - -[handler_fileHandler] -class=FileHandler -level=DEBUG -formatter=simpleFormatter -args=('test.log', 'w') - -[formatter_simpleFormatter] -format=%(asctime)s - %(name)s - %(levelname)s - %(message)s -datefmt=%m/%d/%Y %I:%M:%S %p \ No newline at end of file diff --git a/Python_basics/Logging_infrastructure/141 logging-demo2.py b/Python_basics/Logging_infrastructure/141 logging-demo2.py deleted file mode 100644 index d4c7a27..0000000 --- a/Python_basics/Logging_infrastructure/141 logging-demo2.py +++ /dev/null @@ -1,38 +0,0 @@ -''' -Created on May 30, 2018 -@author: venkateshwara.d -''' -import logging -import loggingpackage.custom_logger as cl - -class LoggingDemo2(): - - log = cl.customLogger(logging.DEBUG) - - def method1(self): - self.log.debug('debug message') - self.log.info('info message') - self.log.warn('warn message') - self.log.error('error message') - self.log.critical('critical message') - - def method2(self): - m2Log = cl.customLogger(logging.INFO) - m2Log.debug('debug message') - m2Log.info('info message') - m2Log.warn('warn message') - m2Log.error('error message') - m2Log.critical('critical message') - - def method3(self): - m3Log = cl.customLogger(logging.INFO) - m3Log.debug('debug message') - m3Log.info('info message') - m3Log.warn('warn message') - m3Log.error('error message') - m3Log.critical('critical message') - -demo = LoggingDemo2() -demo.method1() -demo.method2() -demo.method3() diff --git a/Python_basics/Logging_infrastructure/__init__.py b/Python_basics/Logging_infrastructure/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/Python_basics/MethodsWorkingWithReusableCode/037 methodsdemo1.py b/Python_basics/MethodsWorkingWithReusableCode/037 methodsdemo1.py deleted file mode 100644 index db70622..0000000 --- a/Python_basics/MethodsWorkingWithReusableCode/037 methodsdemo1.py +++ /dev/null @@ -1,16 +0,0 @@ -""" -A group of code statements which can perform some specific task -Methods are reusable and can be called when needed in the code -""" -def sum_nums(n1, n2): - print(n1 + n2) - -sum_nums(2, 8) - -sum_nums(3, 3) - -l = [1, 2, 3] -print(l.append(4)) -print(l) - -print(len(l)) \ No newline at end of file diff --git a/Python_basics/MethodsWorkingWithReusableCode/038 methodsdemo2.py b/Python_basics/MethodsWorkingWithReusableCode/038 methodsdemo2.py deleted file mode 100644 index 231d6bd..0000000 --- a/Python_basics/MethodsWorkingWithReusableCode/038 methodsdemo2.py +++ /dev/null @@ -1,34 +0,0 @@ -""" -A group of code statements which can perform some specific task -Methods are reusable and can be called when needed in the code -""" - -def sum_nums(n1, n2): - """ - Get sum of two numbers - :param n1: - :param n2: - :return: - """ - return n1 + n2 - -sum1 = sum_nums(2, 8) - -sum2 = sum_nums(3, 3) - -string_add = sum_nums('one', 2) -print(string_add) - -print(sum1) -print("*************") - -def isMetro(city): - l = ['sfo', 'nyc', 'la'] - - if city in l: - return True - else: - return False - -x = isMetro('boston') -print(x) \ No newline at end of file diff --git a/Python_basics/MethodsWorkingWithReusableCode/039 methodsdemo3.py b/Python_basics/MethodsWorkingWithReusableCode/039 methodsdemo3.py deleted file mode 100644 index 995ee6c..0000000 --- a/Python_basics/MethodsWorkingWithReusableCode/039 methodsdemo3.py +++ /dev/null @@ -1,17 +0,0 @@ -""" -Positional Parameters -They are like optional parameters -And can be assigned a default value, if no value is provided from outside -""" - -def sum_nums(n1, n2=4): - """ - Get sum of two numbers - :param n1: - :param n2: - :return: - """ - return n1 + n2 - -sum1 = sum_nums(4, n2=12) -print(sum1) \ No newline at end of file diff --git a/Python_basics/MethodsWorkingWithReusableCode/040 methodsdemo4.py b/Python_basics/MethodsWorkingWithReusableCode/040 methodsdemo4.py deleted file mode 100644 index b474110..0000000 --- a/Python_basics/MethodsWorkingWithReusableCode/040 methodsdemo4.py +++ /dev/null @@ -1,26 +0,0 @@ -""" -Variable Scope -""" - -a = 10 - -def test_method(a): - print("Value of local 'a' is: " + str(a)) - a = 2 - print("New value of local 'a' is: " + str(a)) - -print("Value of global 'a' is: " + str(a)) -test_method(a) -print("Did the value of global 'a' change? " + str(a)) - -a = 10 - -def test_method(): - global a - print("Value of 'a' inside the method is: " + str(a)) - a = 2 - print("New value of 'a' inside the method is changed to: " + str(a)) - -print("Value of global a is: " + str(a)) -test_method() -print("Did the value of global 'a' change? " + str(a)) \ No newline at end of file diff --git a/Python_basics/MethodsWorkingWithReusableCode/041 built-in-functions.py b/Python_basics/MethodsWorkingWithReusableCode/041 built-in-functions.py deleted file mode 100644 index e2d035b..0000000 --- a/Python_basics/MethodsWorkingWithReusableCode/041 built-in-functions.py +++ /dev/null @@ -1,36 +0,0 @@ -""" -Some built-in functions -max(): It takes any number of arguments and returns the largest one. - -min(): It takes any number of arguments and returns the smallest one. - -abs(): It returns the absolute value of the number, that number's distance from 0. -It always returns a positive value and it only takes a single number. - -type(): It returns the type of the data it receives as an argument. -""" - -def largest_num(*args): - print(max(args)) - return(max(args)) - -largest_num(-20, -10, 0, 10, 100) - -def smallest_num(*args): - print(min(args)) - -smallest_num(-20, -10, 0, 10, 100) - -def abs_function(a): - print(abs(a)) - -abs_function(-20) -abs_function(20) - -print("**********") - -print(type(99)) -print(type(99.9)) -print(type("99.9")) -l = [1, 2, 3] -print(type(l)) \ No newline at end of file diff --git a/Python_basics/MethodsWorkingWithReusableCode/042 methodexercise.py b/Python_basics/MethodsWorkingWithReusableCode/042 methodexercise.py deleted file mode 100644 index cd6b1bd..0000000 --- a/Python_basics/MethodsWorkingWithReusableCode/042 methodexercise.py +++ /dev/null @@ -1,33 +0,0 @@ -""" -Methods Exercise -Create a method, which takes the state and gross income as the arguments and returns the net income after deducting tax based on the state. - -Assume Federal Tax: 10% -Assume state tax on your wish. - -You don’t have to do for all the states, just take 3-4 to solve the purpose of the exercise. -""" - -def calculateNetIncome(gross, state): - """ - Calculate the net income after federal and state tax - :param gross: Gross Income - :param state: State Name - :return: Net Income - """ - state_tax = {'CA': 10, 'NY': 9, 'TX': 0, 'NJ': 6} - - # Calculate net income after federal tax - net = gross - (gross * .10) - - # Calculate net income after state tax - if state in state_tax: - net = net - (gross * state_tax[state] / 100) - print("Your net income after all the heavy taxes is: " + str(net)) - return net - else: - print("State not in the list") - return None - - -calculateNetIncome(100000, 'CA') \ No newline at end of file diff --git a/Python_basics/MethodsWorkingWithReusableCode/__init__.py b/Python_basics/MethodsWorkingWithReusableCode/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/Python_basics/ObjectOrientedProgramming/043 classdemo1.py b/Python_basics/ObjectOrientedProgramming/043 classdemo1.py deleted file mode 100644 index 47a25d5..0000000 --- a/Python_basics/ObjectOrientedProgramming/043 classdemo1.py +++ /dev/null @@ -1,12 +0,0 @@ -""" -Object Oriented Programming -""" - -s = "this is a string" -a = "one more string" -s.upper() -s.lower() - -print(type('s')) -print(type('a')) -print(type([1, 2, 3])) \ No newline at end of file diff --git a/Python_basics/ObjectOrientedProgramming/044 classdemo2.py b/Python_basics/ObjectOrientedProgramming/044 classdemo2.py deleted file mode 100644 index 364833f..0000000 --- a/Python_basics/ObjectOrientedProgramming/044 classdemo2.py +++ /dev/null @@ -1,17 +0,0 @@ -""" -Object Oriented Programming -""" - -class Car(object): - - def __init__(self, make, model="550i"): - self.make = make - self.model = model - -c1 = Car('bmw') -print(c1.make) -print(c1.model) - -c2 = Car('benz') -print(c2.make) -print(c2.model) \ No newline at end of file diff --git a/Python_basics/ObjectOrientedProgramming/045 classdemo3.py b/Python_basics/ObjectOrientedProgramming/045 classdemo3.py deleted file mode 100644 index a1226b3..0000000 --- a/Python_basics/ObjectOrientedProgramming/045 classdemo3.py +++ /dev/null @@ -1,27 +0,0 @@ -""" -Object Oriented Programming -""" - -class Car(object): - - wheels = 4 - - def __init__(self, make, model): - self.make = make - self.model = model - - def info(self): - print("Make of the car: " + self.make) - print("Model of the car: " + self.model) - - - -c1 = Car('bmw', '550i') -print(c1.make) -#c1.info() - -c2 = Car('benz', 'E350') -print(c2.make) -#c2.info() - -print(Car.wheels) \ No newline at end of file diff --git a/Python_basics/ObjectOrientedProgramming/046 classdemo-inheritance1.py b/Python_basics/ObjectOrientedProgramming/046 classdemo-inheritance1.py deleted file mode 100644 index b043374..0000000 --- a/Python_basics/ObjectOrientedProgramming/046 classdemo-inheritance1.py +++ /dev/null @@ -1,28 +0,0 @@ -''' -Created on May 30, 2018 -@author: venkateshwara.d -''' -class Car(object): - - def __init__(self): - print("You just created the car instance") - - def drive(self): - print("Car started...") - - def stop(self): - print("Car stopped") - -class BMW(Car): - - def __init__(self): - Car.__init__(self) - print("You just created the BMW instance") - -c = Car() -c.drive() -c.stop() - -b = BMW() -b.drive() -b.stop() diff --git a/Python_basics/ObjectOrientedProgramming/047 classdemo-inheritance2.py b/Python_basics/ObjectOrientedProgramming/047 classdemo-inheritance2.py deleted file mode 100644 index 32109a7..0000000 --- a/Python_basics/ObjectOrientedProgramming/047 classdemo-inheritance2.py +++ /dev/null @@ -1,36 +0,0 @@ -''' -Created on May 30, 2018 -@author: venkateshwara.d -''' -class Car(object): - - def __init__(self): - print("You just created the car instance") - - def drive(self): - print("Car started...") - - def stop(self): - print("Car stopped") - -class BMW(Car): - - def __init__(self): - Car.__init__(self) - print("You just created the BMW instance") - - def drive(self): - super(BMW, self).drive() - print("You are driving a BMW, Enjoy...") - - def headsup_display(self): - print("This is a unique feature") - -c = Car() -c.drive() -c.stop() - -b = BMW() -b.drive() -b.stop() -b.headsup_display() diff --git a/Python_basics/ObjectOrientedProgramming/048 classexercise.py b/Python_basics/ObjectOrientedProgramming/048 classexercise.py deleted file mode 100644 index 2dd9fb6..0000000 --- a/Python_basics/ObjectOrientedProgramming/048 classexercise.py +++ /dev/null @@ -1,35 +0,0 @@ -''' -Created on May 30, 2018 -@author: venkateshwara.d -''' -class Fruit(object): - - def __init__(self): - print("I am a fruit") - - def nutrition(self): - print("I am full of vitamins") - - def fruit_shape(self): - print("Every fruit can have different shape") - -class Orange(Fruit): - - def __init__(self): - Fruit.__init__(self) - print("I am Orange") - - def nutrition(self): - print("I am full of vitamin c") - - def color(self): - print("I keep it simple, the color is also orange") - -f = Fruit() -f.nutrition() -f.fruit_shape() - -o = Orange() -o.nutrition() -o.fruit_shape() -o.color() diff --git a/Python_basics/ObjectOrientedProgramming/052 modules-demo1.py b/Python_basics/ObjectOrientedProgramming/052 modules-demo1.py deleted file mode 100644 index 046d007..0000000 --- a/Python_basics/ObjectOrientedProgramming/052 modules-demo1.py +++ /dev/null @@ -1,15 +0,0 @@ -""" -https://docs.python.org/3/library/ -""" -import math -from math import sqrt - -class ModulesDemo(): - - def builtin_modules(self): - print(math.sqrt(100)) - print(sqrt(100)) - - -m = ModulesDemo() -m.builtin_modules() \ No newline at end of file diff --git a/Python_basics/ObjectOrientedProgramming/053 modules-car.py b/Python_basics/ObjectOrientedProgramming/053 modules-car.py deleted file mode 100644 index f6434fe..0000000 --- a/Python_basics/ObjectOrientedProgramming/053 modules-car.py +++ /dev/null @@ -1,7 +0,0 @@ -""" -This is our own module which does not exist in python builtins -""" - -def info(make, model): - print("Make of the car: " + make) - print("Model of the car: " + model) \ No newline at end of file diff --git a/Python_basics/ObjectOrientedProgramming/__init__.py b/Python_basics/ObjectOrientedProgramming/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/Python_basics/ProgramControlFlow/031 conditional.py b/Python_basics/ProgramControlFlow/031 conditional.py deleted file mode 100644 index d237418..0000000 --- a/Python_basics/ProgramControlFlow/031 conditional.py +++ /dev/null @@ -1,17 +0,0 @@ -""" -Conditional Logic -""" - -if 100 > 10: - print("Hundred is greater than 10") - -value = 'red' - -if value == 'green': - print("Go") -elif value == 'yellow': - print("Prepare to stop") -else: - print("Stop") - -print("It will always print") diff --git a/Python_basics/ProgramControlFlow/032 whiledemo.py b/Python_basics/ProgramControlFlow/032 whiledemo.py deleted file mode 100644 index 5a06b29..0000000 --- a/Python_basics/ProgramControlFlow/032 whiledemo.py +++ /dev/null @@ -1,19 +0,0 @@ -""" -Execute statements repeatedly -Conditions are used to stop the execution of loops -Iterable items are Strings, List, Tuple, Dictionary -""" - -x = 0 -while x < 10: - print("Value of x is: " + str(x)) - x = x + 1 - -l = [] -num = 0 -while num < 10: - l.append(num) - print("Value of num is: " + str(num)) - num += 1 - -print(l) \ No newline at end of file diff --git a/Python_basics/ProgramControlFlow/033 breakcontinue.py b/Python_basics/ProgramControlFlow/033 breakcontinue.py deleted file mode 100644 index 27a796a..0000000 --- a/Python_basics/ProgramControlFlow/033 breakcontinue.py +++ /dev/null @@ -1,28 +0,0 @@ -""" -Break: To break out of the closest enclosing loop -Continue: Go to the start of the closest enclosing loop -""" - -x = 0 -while x < 10: - print("Value of x is: " + str(x)) - x = x + 1 - - if x == 8: - break - print("This example is awesome") - print("*"*20) -else: - print("Just broke out of the loop") - -# x = 0 -# while x < 10: -# print("Value of x is: " + str(x)) -# x = x + 1 -# -# if x == 8: -# continue -# print("This example is awesome") -# print("*"*20) -# -# print("Just broke out of the loop") \ No newline at end of file diff --git a/Python_basics/ProgramControlFlow/036 rangedemo.py b/Python_basics/ProgramControlFlow/036 rangedemo.py deleted file mode 100644 index 56768fe..0000000 --- a/Python_basics/ProgramControlFlow/036 rangedemo.py +++ /dev/null @@ -1,17 +0,0 @@ -""" -Built-in function -Creates a sequence of numbers but does not save them in memory -Very useful for generating numbers -""" - -a = range(0, 20, 6) -print(a) -print(type(a)) - -print(list(a)) - - -l = [1, 2, 3] - -for num in range(1, 4): - print(num) \ No newline at end of file diff --git a/Python_basics/ProgramControlFlow/__init__.py b/Python_basics/ProgramControlFlow/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/Python_basics/Pytest_AdvancedTestingFramework/148 test-case-demo1.py b/Python_basics/Pytest_AdvancedTestingFramework/148 test-case-demo1.py deleted file mode 100644 index 0d6e330..0000000 --- a/Python_basics/Pytest_AdvancedTestingFramework/148 test-case-demo1.py +++ /dev/null @@ -1,15 +0,0 @@ -''' -Created on May 30, 2018 -@author: venkateshwara.d -''' -import pytest - -@pytest.fixture() -def setUp(): - print("Running demo1 setUp") - -def test_demo1_methodA(setUp): - print("Running demo1 method A") - -def test_demo1_methodB(setUp): - print("Running demo1 method B") diff --git a/Python_basics/Pytest_AdvancedTestingFramework/149 -PyTest-Naming-Conventions.pdf b/Python_basics/Pytest_AdvancedTestingFramework/149 -PyTest-Naming-Conventions.pdf deleted file mode 100644 index 794c10f..0000000 Binary files a/Python_basics/Pytest_AdvancedTestingFramework/149 -PyTest-Naming-Conventions.pdf and /dev/null differ diff --git a/Python_basics/Pytest_AdvancedTestingFramework/150 test-case-demo2.py b/Python_basics/Pytest_AdvancedTestingFramework/150 test-case-demo2.py deleted file mode 100644 index 74b7cbf..0000000 --- a/Python_basics/Pytest_AdvancedTestingFramework/150 test-case-demo2.py +++ /dev/null @@ -1,16 +0,0 @@ -''' -Created on May 30, 2018 -@author: venkateshwara.d -''' -import pytest -@pytest.yield_fixture() -def setUp(): - print("Running demo2 setUp") - yield - print("Running demo2 tearDown") - -def test_demo2_methodA(setUp): - print("Running demo2 method A") - -def test_demo2_methodB(setUp): - print("Running demo2 method B") diff --git a/Python_basics/Pytest_AdvancedTestingFramework/152 test-case-demo3.py b/Python_basics/Pytest_AdvancedTestingFramework/152 test-case-demo3.py deleted file mode 100644 index 46ec8e6..0000000 --- a/Python_basics/Pytest_AdvancedTestingFramework/152 test-case-demo3.py +++ /dev/null @@ -1,25 +0,0 @@ -""" -file name should start with test -test method name should start with test - -py.test test_mod.py # run tests in module -py.test somepath # run all tests below somepath -py.test test_module.py::test_method # only run test_method in test_module - --s to print statements --v verbose -""" - -import pytest - -@pytest.yield_fixture() -def setUp(): - print("Running demo3 setUp") - yield - print("Running demo3 tearDown") - -def test_demo3_methodA(setUp): - print("Running demo3 method A") - -def test_demo3_methodB(setUp): - print("Running demo3 method B") \ No newline at end of file diff --git a/Python_basics/Pytest_AdvancedTestingFramework/154 conftest.py b/Python_basics/Pytest_AdvancedTestingFramework/154 conftest.py deleted file mode 100644 index be111f9..0000000 --- a/Python_basics/Pytest_AdvancedTestingFramework/154 conftest.py +++ /dev/null @@ -1,18 +0,0 @@ -''' -Created on May 30, 2018 -@author: venkateshwara.d -''' -import pytest - -@pytest.yield_fixture() -def setUp(): - print("Running method level setUp") - yield - print("Running method level tearDown") - - -@pytest.yield_fixture(scope="module") -def oneTimeSetUp(): - print("Running conftest demo one time setUp") - yield - print("Running conftest demo one time tearDown") diff --git a/Python_basics/Pytest_AdvancedTestingFramework/155 conftest.py b/Python_basics/Pytest_AdvancedTestingFramework/155 conftest.py deleted file mode 100644 index be111f9..0000000 --- a/Python_basics/Pytest_AdvancedTestingFramework/155 conftest.py +++ /dev/null @@ -1,18 +0,0 @@ -''' -Created on May 30, 2018 -@author: venkateshwara.d -''' -import pytest - -@pytest.yield_fixture() -def setUp(): - print("Running method level setUp") - yield - print("Running method level tearDown") - - -@pytest.yield_fixture(scope="module") -def oneTimeSetUp(): - print("Running conftest demo one time setUp") - yield - print("Running conftest demo one time tearDown") diff --git a/Python_basics/Pytest_AdvancedTestingFramework/156 conftest.py b/Python_basics/Pytest_AdvancedTestingFramework/156 conftest.py deleted file mode 100644 index 24f6dd2..0000000 --- a/Python_basics/Pytest_AdvancedTestingFramework/156 conftest.py +++ /dev/null @@ -1,34 +0,0 @@ -''' -Created on May 30, 2018 -@author: venkateshwara.d -''' -import pytest - -@pytest.yield_fixture() -def setUp(): - print("Running method level setUp") - yield - print("Running method level tearDown") - - -@pytest.yield_fixture(scope="module") -def oneTimeSetUp(browser, osType): - print("Running one time setUp") - if browser == 'firefox': - print("Running tests on FF") - else: - print("Running tests on chrome") - yield - print("Running one time tearDown") - -def pytest_addoption(parser): - parser.addoption("--browser") - parser.addoption("--osType", help="Type of operating system") - -@pytest.fixture(scope="session") -def browser(request): - return request.config.getoption("--browser") - -@pytest.fixture(scope="session") -def osType(request): - return request.config.getoption("--osType") diff --git a/Python_basics/Pytest_AdvancedTestingFramework/157 conftest.py b/Python_basics/Pytest_AdvancedTestingFramework/157 conftest.py deleted file mode 100644 index 243255a..0000000 --- a/Python_basics/Pytest_AdvancedTestingFramework/157 conftest.py +++ /dev/null @@ -1,34 +0,0 @@ -''' -Created on May 30, 2018 -@author: venkateshwara.d -''' -import pytest - -@pytest.yield_fixture() -def setUp(): - print("Running method level setUp") - yield - print("Running method level tearDown") - - -@pytest.yield_fixture(scope="class") -def oneTimeSetUp(browser): - print("Running one time setUp") - if browser == 'firefox': - print("Running tests on FF") - else: - print("Running tests on chrome") - yield - print("Running one time tearDown") - -def pytest_addoption(parser): - parser.addoption("--browser") - parser.addoption("--osType", help="Type of operating system") - -@pytest.fixture(scope="session") -def browser(request): - return request.config.getoption("--browser") - -@pytest.fixture(scope="session") -def osType(request): - return request.config.getoption("--osType") diff --git a/Python_basics/Pytest_AdvancedTestingFramework/158 conftest.py b/Python_basics/Pytest_AdvancedTestingFramework/158 conftest.py deleted file mode 100644 index 9c975d4..0000000 --- a/Python_basics/Pytest_AdvancedTestingFramework/158 conftest.py +++ /dev/null @@ -1,40 +0,0 @@ -''' -Created on May 30, 2018 -@author: venkateshwara.d -''' -import pytest - -@pytest.yield_fixture() -def setUp(): - print("Running method level setUp") - yield - print("Running method level tearDown") - - -@pytest.yield_fixture(scope="class") -def oneTimeSetUp(request, browser): - print("Running one time setUp") - if browser == 'firefox': - value = 10 - print("Running tests on FF") - else: - value = 20 - print("Running tests on chrome") - - if request.cls is not None: - request.cls.value = value - - yield value - print("Running one time tearDown") - -def pytest_addoption(parser): - parser.addoption("--browser") - parser.addoption("--osType", help="Type of operating system") - -@pytest.fixture(scope="session") -def browser(request): - return request.config.getoption("--browser") - -@pytest.fixture(scope="session") -def osType(request): - return request.config.getoption("--osType") diff --git a/Python_basics/Pytest_AdvancedTestingFramework/160 conftest.py b/Python_basics/Pytest_AdvancedTestingFramework/160 conftest.py deleted file mode 100644 index 9c975d4..0000000 --- a/Python_basics/Pytest_AdvancedTestingFramework/160 conftest.py +++ /dev/null @@ -1,40 +0,0 @@ -''' -Created on May 30, 2018 -@author: venkateshwara.d -''' -import pytest - -@pytest.yield_fixture() -def setUp(): - print("Running method level setUp") - yield - print("Running method level tearDown") - - -@pytest.yield_fixture(scope="class") -def oneTimeSetUp(request, browser): - print("Running one time setUp") - if browser == 'firefox': - value = 10 - print("Running tests on FF") - else: - value = 20 - print("Running tests on chrome") - - if request.cls is not None: - request.cls.value = value - - yield value - print("Running one time tearDown") - -def pytest_addoption(parser): - parser.addoption("--browser") - parser.addoption("--osType", help="Type of operating system") - -@pytest.fixture(scope="session") -def browser(request): - return request.config.getoption("--browser") - -@pytest.fixture(scope="session") -def osType(request): - return request.config.getoption("--osType") diff --git a/Python_basics/Pytest_AdvancedTestingFramework/__init__.py b/Python_basics/Pytest_AdvancedTestingFramework/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/Python_basics/PythonTutorial.rar b/Python_basics/PythonTutorial.rar deleted file mode 100644 index 945d886..0000000 Binary files a/Python_basics/PythonTutorial.rar and /dev/null differ diff --git a/Python_basics/RunningCompleteTestSuite/190 1-register-courses-csv-data.py b/Python_basics/RunningCompleteTestSuite/190 1-register-courses-csv-data.py deleted file mode 100644 index 9dc6122..0000000 --- a/Python_basics/RunningCompleteTestSuite/190 1-register-courses-csv-data.py +++ /dev/null @@ -1,38 +0,0 @@ -''' -Created on May 30, 2018 -@author: venkateshwara.d -''' -from pages.courses.register_courses_page import RegisterCoursesPage -from pages.home.navigation_page import NavigationPage -from utilities.teststatus import TestStatus -import unittest, pytest -from ddt import ddt, data, unpack -from utilities.read_data import getCSVData -import time - -@pytest.mark.usefixtures("oneTimeSetUp", "setUp") -@ddt -class RegisterCoursesCSVDataTests(unittest.TestCase): - - @pytest.fixture(autouse=True) - def objectSetup(self, oneTimeSetUp): - self.courses = RegisterCoursesPage(self.driver) - self.ts = TestStatus(self.driver) - self.nav = NavigationPage(self.driver) - - def setUp(self): - self.nav.navigateToAllCourses() - - @pytest.mark.run(order=1) - @data(*getCSVData("/Users/atomar/Documents/workspace_python/letskodeit/testdata.csv")) - @unpack - def test_invalidEnrollment(self, courseName, ccNum, ccExp, ccCVV): - self.courses.enterCourseName(courseName) - time.sleep(1) - self.courses.selectCourseToEnroll(courseName) - time.sleep(1) - self.courses.enrollCourse(num=ccNum, exp=ccExp, cvv=ccCVV) - time.sleep(1) - result = self.courses.verifyEnrollFailed() - self.ts.markFinal("test_invalidEnrollment", result, - "Enrollment Failed Verification") diff --git a/Python_basics/RunningCompleteTestSuite/191 2-login-tests.py b/Python_basics/RunningCompleteTestSuite/191 2-login-tests.py deleted file mode 100644 index e93bfe4..0000000 --- a/Python_basics/RunningCompleteTestSuite/191 2-login-tests.py +++ /dev/null @@ -1,31 +0,0 @@ -''' -Created on May 30, 2018 -@author: venkateshwara.d -''' -from pages.home.login_page import LoginPage -from utilities.teststatus import TestStatus -import unittest -import pytest - -@pytest.mark.usefixtures("oneTimeSetUp", "setUp") -class LoginTests(unittest.TestCase): - - @pytest.fixture(autouse=True) - def objectSetup(self, oneTimeSetUp): - self.lp = LoginPage(self.driver) - self.ts = TestStatus(self.driver) - - @pytest.mark.run(order=2) - def test_validLogin(self): - self.lp.login("test@email.com", "abcabc") - result1 = self.lp.verifyLoginTitle() - self.ts.mark(result1, "Title Verification") - result2 = self.lp.verifyLoginSuccessful() - self.ts.markFinal("test_validLogin", result2, "Login Verification") - - @pytest.mark.run(order=1) - def test_invalidLogin(self): - self.lp.logout() - self.lp.login("test@email.com", "abcabcabc") - result = self.lp.verifyLoginFailed() - assert result == True diff --git a/Python_basics/RunningCompleteTestSuite/192 3-test-suite-demo.py b/Python_basics/RunningCompleteTestSuite/192 3-test-suite-demo.py deleted file mode 100644 index ecfac0c..0000000 --- a/Python_basics/RunningCompleteTestSuite/192 3-test-suite-demo.py +++ /dev/null @@ -1,16 +0,0 @@ -''' -Created on May 30, 2018 -@author: venkateshwara.d -''' -import unittest -from tests.home.login_tests import LoginTests -from tests.courses.register_courses_csv_data import RegisterCoursesCSVDataTests - -# Get all tests from the test classes -tc1 = unittest.TestLoader().loadTestsFromTestCase(LoginTests) -tc2 = unittest.TestLoader().loadTestsFromTestCase(RegisterCoursesCSVDataTests) - -# Create a test suite combining all test classes -smokeTest = unittest.TestSuite([tc1, tc2]) - -unittest.TextTestRunner(verbosity=2).run(smokeTest) diff --git a/Python_basics/RunningCompleteTestSuite/193 4-webdriverfactory.py b/Python_basics/RunningCompleteTestSuite/193 4-webdriverfactory.py deleted file mode 100644 index dff78ee..0000000 --- a/Python_basics/RunningCompleteTestSuite/193 4-webdriverfactory.py +++ /dev/null @@ -1,62 +0,0 @@ -""" -@package base - -WebDriver Factory class implementation -It creates a webdriver instance based on browser configurations - -Example: - wdf = WebDriverFactory(browser) - wdf.getWebDriverInstance() -""" -import traceback -from selenium import webdriver -import os - -class WebDriverFactory(): - - def __init__(self, browser): - """ - Inits WebDriverFactory class - - Returns: - None - """ - self.browser = browser - """ - Set chrome driver and iexplorer environment based on OS - - chromedriver = "C:/.../chromedriver.exe" - os.environ["webdriver.chrome.driver"] = chromedriver - self.driver = webdriver.Chrome(chromedriver) - - PREFERRED: Set the path on the machine where browser will be executed - """ - - def getWebDriverInstance(self): - """ - Get WebDriver Instance based on the browser configuration - - Returns: - 'WebDriver Instance' - """ - baseURL = "https://letskodeit.teachable.com/" - if self.browser == "iexplorer": - # Set ie driver - driver = webdriver.Ie() - elif self.browser == "firefox": - driver = webdriver.Firefox() - elif self.browser == "chrome": - # Set chrome driver - chromedriver = "/Users/atomar/Documents/workspace_personal/selenium/chromedriver" - os.environ["webdriver.chrome.driver"] = chromedriver - driver = webdriver.Chrome(chromedriver) - driver.set_window_size(1440, 900) - else: - driver = webdriver.Firefox() - # Setting Driver Implicit Time out for An Element - driver.implicitly_wait(3) - # Maximize the window - driver.maximize_window() - # Loading browser with App URL - driver.get(baseURL) - return driver \ No newline at end of file diff --git a/Python_basics/RunningCompleteTestSuite/__init__.py b/Python_basics/RunningCompleteTestSuite/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/Python_basics/SeleniumWD2Tutorial.rar b/Python_basics/SeleniumWD2Tutorial.rar deleted file mode 100644 index 9b65fc5..0000000 Binary files a/Python_basics/SeleniumWD2Tutorial.rar and /dev/null differ diff --git a/Python_basics/SeleniumWebDriverRunningTestsOnVariousBrowsers/064 RunFFTests.py b/Python_basics/SeleniumWebDriverRunningTestsOnVariousBrowsers/064 RunFFTests.py deleted file mode 100644 index 15621c1..0000000 --- a/Python_basics/SeleniumWebDriverRunningTestsOnVariousBrowsers/064 RunFFTests.py +++ /dev/null @@ -1,23 +0,0 @@ -''' -Created on May 30, 2018 -@author: venkateshwara.d -''' -from selenium import webdriver -import os -import time - -class RunFFTests(): - - def test(self): - - #executable_path = os.path.abspath('..') + "\\Drivers\\geckodriver.exe" - # Instantiate FF Browser Command - driver = webdriver.Firefox(executable_path=r'C:\\Users\venkateshwara.d\\git\\selenium_with_python\\Python_basics\\Drivers\\geckodriver.exe') - # Open the provided URL - driver.get("http://www.letskodeit.com") - - time.sleep(10) - driver.quit() - -ff = RunFFTests() -ff.test() diff --git a/Python_basics/SeleniumWebDriverRunningTestsOnVariousBrowsers/066 RunChromeTestsWindows.py b/Python_basics/SeleniumWebDriverRunningTestsOnVariousBrowsers/066 RunChromeTestsWindows.py deleted file mode 100644 index f63f173..0000000 --- a/Python_basics/SeleniumWebDriverRunningTestsOnVariousBrowsers/066 RunChromeTestsWindows.py +++ /dev/null @@ -1,18 +0,0 @@ -''' -Created on May 30, 2018 -@author: venkateshwara.d -''' -from selenium import webdriver -import os - -class RunChromeTestsWindows(): - # https://sites.google.com/a/chromium.org/chromedriver/downloads - # http://chromedriver.storage.googleapis.com/index.html?path=2.21/ - def test(self): - driverLocation = os.path.abspath('..') + "\\Drivers\\chromedriver.exe" - os.environ["webdriver.chrome.driver"] = driverLocation - driver = webdriver.Chrome(driverLocation) - driver.get("http://www.letskodeit.com") - -chromeTest = RunChromeTestsWindows() -chromeTest.test() diff --git a/Python_basics/SeleniumWebDriverRunningTestsOnVariousBrowsers/070 RunSafariTests.py b/Python_basics/SeleniumWebDriverRunningTestsOnVariousBrowsers/070 RunSafariTests.py deleted file mode 100644 index 4aaa550..0000000 --- a/Python_basics/SeleniumWebDriverRunningTestsOnVariousBrowsers/070 RunSafariTests.py +++ /dev/null @@ -1,21 +0,0 @@ -''' -Created on May 30, 2018 -@author: venkateshwara.d -''' -from selenium import webdriver -import os - -class RunSafariTests(): - # https://github.com/SeleniumHQ/selenium/wiki/SafariDriver - # http://selenium-release.storage.googleapis.com/index.html - - def test(self): - serverLocation = "/Users/atomar/Documents/workspace_personal/selenium/selenium-server-standalone-2.53.0.jar" - os.environ["SELENIUM_SERVER_JAR"] = serverLocation - # Instantiate Safari Browser Command - driver = webdriver.Safari(quiet=True) - # Open the provided URL - driver.get("http://www.letskodeit.com") - -safari = RunSafariTests() -safari.test() diff --git a/Python_basics/SeleniumWebDriverRunningTestsOnVariousBrowsers/071 Interview-Questions.pdf b/Python_basics/SeleniumWebDriverRunningTestsOnVariousBrowsers/071 Interview-Questions.pdf deleted file mode 100644 index 82be41e..0000000 Binary files a/Python_basics/SeleniumWebDriverRunningTestsOnVariousBrowsers/071 Interview-Questions.pdf and /dev/null differ diff --git a/Python_basics/SeleniumWebDriverRunningTestsOnVariousBrowsers/__init__.py b/Python_basics/SeleniumWebDriverRunningTestsOnVariousBrowsers/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/Python_basics/SeleniumWebDriverUsefulMethodsAndProperties/106 2-airbnb-exercise1.py b/Python_basics/SeleniumWebDriverUsefulMethodsAndProperties/106 2-airbnb-exercise1.py deleted file mode 100644 index efa55bc..0000000 --- a/Python_basics/SeleniumWebDriverUsefulMethodsAndProperties/106 2-airbnb-exercise1.py +++ /dev/null @@ -1,65 +0,0 @@ -''' -Created on May 30, 2018 -@author: venkateshwara.d -''' -from selenium import webdriver -from selenium.webdriver.common.by import By -import time -import os -from selenium.webdriver.support.select import Select - -class AirbnbExercise1(): - - def test(self): - baseUrl = "https://www.airbnb.com/" - chrome_driver_path = os.path.abspath('..') + "\\Drivers\\chromedriver.exe" - - driver=webdriver.Chrome(chrome_driver_path) - #driver = webdriver.Chrome() - driver.maximize_window() - driver.get(baseUrl) - driver.implicitly_wait(10) - - # Elements and design has changed on Airbnb website after the lecture was made - searchBox = driver.find_element(By.NAME, "location") - searchBox.send_keys("Hawaii") - - when = driver.find_element(By.XPATH, - "(//button//span[text()='Anytime'])[2]") - when.click() - time.sleep(2) - - checkin = driver.find_element(By.XPATH, - "(//div[contains(@class,'CalendarMonth') and @data-visible='true']//div[text()='30']//parent::button)[1]") - checkin.click() - - checkout = driver.find_element(By.XPATH, - "(//div[contains(@class,'CalendarMonth') and @data-visible='true']//div[text()='30']//parent::button)[2]") - checkout.click() - - showInstant = driver.find_elements(By.XPATH, "//span[text()='Show Instant Book Listings']") - if len(showInstant) > 0: - showInstant[0].click() - - dropdownElement = driver.find_element(By.XPATH, - "(//span[text()='1 guest'])[2]") - #sel = Select(dropdownElement) - #sel.select_by_visible_text("2 Guests") - # It is updated to