def after_scenario(context, scenario): context.driver.find_element_by_xpath( ConfigReader.readElementLocators("Home", "Global_Header_xpath")).click() context.driver.find_element_by_xpath( ConfigReader.readElementLocators("Home", "Logout_option_xpath")).click()
def startBrowser(): bwtype = ConfigReader.readConfigData("Details", "Browser") App_URL = ConfigReader.readConfigData("Details", "App_URL") global driver print("inside startbrowser", bwtype) if bwtype == "Firefox": path = ConfigReader.readConfigData("Details", "drvPath") driver = webdriver.Firefox(executable_path=path) driver.get(App_URL) driver.maximize_window() elif bwtype == "Chrome": path = ConfigReader.readConfigData("Details", "drvPath") driver = webdriver.Chrome(executable_path=path) driver.get(App_URL) driver.maximize_window() else: path = ConfigReader.readConfigData("Details", "drvPath") driver = webdriver.Chrome(executable_path=path) driver.get(App_URL) driver.maximize_window() return driver
def test_search_valid_data(data): driver = InitiateDriver.start_browser() search = SearchPage.SearchPage(driver) driver.find_element_by_xpath(ConfigReader.read_elements('Search', 'search_icon')).click() search.enter_key(data[0]) driver.find_element_by_xpath(ConfigReader.read_elements('Search', 'search_button')).click() driver.close()
def selectHostingLocation(self, HL): driver.find_element_by_xpath( ConfigReader.readElementLocators( 'Asset', 'HostingLocation_xpath')).send_keys(HL) driver.find_element_by_xpath( ConfigReader.readElementLocators('Asset', 'country_xpath')).click()
def step_impl(context): context.LocalRecord = context.driver.find_element_by_xpath( ConfigReader.readElementLocators('LocalVersions_tab', 'Local_record_xpath')) action = ActionChains(context.driver) action.move_to_element_with_offset(context.LocalRecord, 0, 0) action.perform() time.sleep(3) context.driver.find_element_by_xpath( ConfigReader.readElementLocators('LocalVersions_tab', 'Local_Version_elipse')).click() context.driver.find_element_by_xpath( ConfigReader.readElementLocators('LocalVersions_tab', 'RemoveLocalVersion_xpath')).click() RemoveLocalVersionModal = context.driver.find_element_by_xpath( ConfigReader.readElementLocators('LocalVersions_tab', 'Remove_local_version_modal')) try: WebDriverWait(context.driver, 120).until(EC.visibility_of(RemoveLocalVersionModal)) except TimeoutException: print("Create LocalVersion Modal not found") context.driver.find_element_by_xpath( ConfigReader.readElementLocators('LocalVersions_tab', 'Confirm_button_xpath')).click() time.sleep(3)
def test_searchjob(self): time.sleep(10) self.driver.find_element_by_xpath(ConfigReader.test_searchlocal("Search", 'xpa')).click() #self.driver.find_element_by_class_name(ConfigReader.test_PopUpmodal("Popup", "Later")).click() self.driver.find_element_by_class_name(ConfigReader.test_searchlocal("Search", "Skill")).send_keys("python") self.driver.find_element_by_xpath(ConfigReader.test_searchlocal("Search", "Location")).send_keys("Chandigarh") self.driver.find_element_by_xpath(ConfigReader.test_searchlocal("Search", "Experience")).click() time.sleep(3)
def step_impl(context): Try_for_free = context.driver.find_element_by_xpath( ConfigReader.readElementLocators('DG', 'Try_for_free(Action_Banner)_xpath')) Login = context.driver.find_element_by_xpath( ConfigReader.readElementLocators('DG', 'Login(Action_Banner)_xpath')) assert Try_for_free assert Login
def book_one_way_ticket(self, source, destination): driver.find_element_by_link_text( ConfigReader.readElements("Flight", "click_flight_loc")).click() driver.find_element_by_id( ConfigReader.readElements("Flight", "source_loc")).send_keys(source) driver.find_element_by_id( ConfigReader.readElements( "Flight", "deestination_loc")).send_keys(destination)
def book_bus(self, source, destination): driver.find_element_by_xpath( ConfigReader.readElements("Bus", "click_bus_loc")) driver.find_element_by_id( ConfigReader.readElements("Bus", "bus_source_loc")).send_keys(source) driver.find_element_by_id( ConfigReader.readElements( "Bus", "bus_destination")).send_keys(destination)
def step_impl(context): context.LocalVersionTab_1 = context.driver.find_element_by_xpath( ConfigReader.readElementLocators('LocalVersions_tab', 'Local_versions_xpath')) context.LocalVersionTab_1.click() time.sleep(3) context.driver.find_element_by_xpath( ConfigReader.readElementLocators( 'LocalVersions_tab', 'Add_local_Versions_button_xpath')).click()
def test_ValidateRegistration(): driver = InitiateDriver.startBrowser() driver.find_element_by_name( ConfigReader.fetchElementLocators("Registration", "username_name")).send_keys("Hello") driver.find_element_by_name( ConfigReader.fetchElementLocators("Registration", "email_name")).send_keys("abcd") InitiateDriver.closeBrowser()
def startBrowser(): global driver if (ConfigReader.configRead('Details', 'Browser') == "Chrome"): path = "./Drivers/chromedriver.exe" driver = Chrome(executable_path=path) driver.get(ConfigReader.configRead('Details', 'url')) driver.maximize_window() return driver
def test_Loginpage(): driver = Initialise_Browser.startBrowser() driver.find_element_by_xpath(ConfigReader.Login('Login', 'login')).click() driver.find_element_by_xpath(ConfigReader.Login( 'Login', 'username')).send_keys("raghavan8007") driver.find_element_by_xpath(ConfigReader.Login( 'Login', 'password')).send_keys("Akhil@007") #driver.find_element_by_xpath("//input[@type='checkbox']").click() driver.implicitly_wait(5) driver.find_element_by_xpath(ConfigReader.Login('Login', 'signin')).click()
def step_impl(context): time.sleep(5) context.inventory_new = context.driver.find_element_by_xpath( ConfigReader.readElementLocators('DM', 'Asset_link')) context.inventory_new.click() time.sleep(5) context.LocalVersionTab_1 = context.driver.find_element_by_xpath( ConfigReader.readElementLocators('LocalVersions_tab', 'Local_versions_xpath')) context.LocalVersionTab_1.click() time.sleep(3)
def startbrowser(): global driver # Reading the Browser details from the Configuration file if ConfigReader.readConfigData('Details', 'Browser') == "Chrome": PATH = "../Driver/chromedriver.exe" driver = Chrome(executable_path=PATH) elif ConfigReader.readConfigData('Details', 'Browser') == "Firefox": PATH = "../Driver/geckodriver.exe" driver = Firefox(executable_path=PATH) url = ConfigReader.readConfigData('Details', 'Application_URL') # driver.maximize() return driver
def start_browser(): global driver if (ConfigReader.read_config_data('Details', "Browser") == "chrome"): path = "./Driver/chromedriver.exe" driver = Chrome(executable_path=path) elif (ConfigReader.read_config_data('Details', "Browser") == "firefox"): path = "./Driver/geckodriver.exe" driver = Firefox(executable_path=path) else: path = "./Driver/chromedriver.exe" driver = Chrome(executable_path=path) driver.get(ConfigReader.read_config_data('Details', 'Application_URL')) driver.maximize_window() return driver
def startBrowser(): global driver #to use driver object in different methods in this file if ((ConfigReader.readConfigData('Details', 'Browser')) == "chrome"): path = "./DriverFiles/chromedriver.exe" driver = Chrome(executable_path=path) elif ((ConfigReader.readConfigData('Details', 'Browser')) == "Firefox"): path = "./DriverFiles/geckodriver.exe" driver = Firefox(executable_path=path) else: path = "./DriverFiles/chromedriver.exe" driver = Chrome(executable_path=path) driver.get(ConfigReader.readConfigData('Details', 'Application_URL')) driver.maximize_window() return driver
def step_impl(context): context.inventory_new = context.driver.find_element_by_xpath( ConfigReader.readElementLocators('DM', 'Asset_link')) action = ActionChains(context.driver) action.move_to_element_with_offset(context.inventory_new, 0, 0) action.perform() time.sleep(10)
def step_impl(context): time.sleep(10) Login_btn = context.driver.find_element_by_xpath( ConfigReader.readElementLocators('DG', 'Login(Action_Banner)_xpath')) action = ActionChains(context.driver) action.move_to_element(Login_btn) action.perform()
def startBrowser(): global driver path = "C:\\Users\\milin\\PycharmProjects\\chromedriver.exe" driver = Chrome(executable_path=path) driver.get(ConfigReader.readConfigData('Registration', 'email_name')) driver.maximize_window() return driver
def StartBrowser(): global driver path = "C:\\Users\\Kanika Gupta\\Downloads\\chromedriver_win32\\chromedriver.exe" driver = Chrome(executable_path=path) driver.get(ConfigReader.read_config("Details", "Application_URL")) driver.maximize_window() return driver
def test_enter_password(): driver = InitiateDriver.startBrowser() driver.find_element_by_name( ConfigReader.fetchElementLocators('Registration', 'password')).send_keys('abc') time.sleep(3) InitiateDriver.closeBrowser()
def startBrowser(): global driver path = "C:/Python38/Scripts/chromedriver.exe" driver = Chrome(executable_path=path) driver.get(ConfigReader.readConfigData('Details', 'Application_URL')) driver.maximize_window() return driver
def startBrowser(): global driver if (ConfigReader.readconfigData('Details', 'Browser') == "Chrome"): path = "./Driver/chromedriver.exe" driver = webdriver.Chrome(executable_path=path) elif (ConfigReader.readconfigData('Details', 'Browser') == "firefox"): path = "./Driver/geckodriver.exe" driver = webdriver.Firefox(executable_path=path) #driver.get("https://www.thetestingworld.com/testings/") url1 = ConfigReader.readconfigData('Details', 'Application_URL') print("url 1 is :: " + url1) #driver.get(ConfigReader.readconfigData('Details','Application_URL')) driver.get(url1) driver.maximize_window() return driver
def startBroswer(): global driver if ConfigReader.readConfigData('Details', 'Application_URL') == "Chrome": path = "C:\\Users\\User\\Desktop\\Chrome WebDriver\\chromedriver_win32\\chromedriver.exe" driver = Chrome(executable_path=path) elif ConfigReader.readConfigData('Details', 'Application_URL') == "Firefox": path = "C:\\Program Files\\Mozilla Firefox\\firefox.exe" driver = Firefox(executable_path=path) else: path = "C:\\Users\\User\\Desktop\\Chrome WebDriver\\chromedriver_win32\\chromedriver.exe" driver = Chrome(executable_path=path) driver.get(ConfigReader.readConfigData('Details', 'Application_URL')) driver.implicitly_wait(15) driver.maximize_window() return driver
def step_impl(context): context.inventory = context.driver.find_element_by_xpath( ConfigReader.readElementLocators('DM', 'Asset_link')) action = ActionChains(context.driver) action.move_to_element(context.inventory) action.perform() #from selenium import webdriver #from selenium_move_cursor.MouseActions import move_to_element_chrome time.sleep(5)
def step_impl(context): LocalVersionModal = context.driver.find_element_by_xpath( ConfigReader.readElementLocators('LocalVersions_tab', 'Create_local_version_modal')) try: WebDriverWait(context.driver, 120).until(EC.visibility_of(LocalVersionModal)) except TimeoutException: print("Create LocalVersion Modal not found")
def startBrowser(self): global driver driver = Chrome("C:\\Users\\pankaj_kumar4\\Downloads\\chromedriver79.exe") # driver.get("https://thetestingworld.com/testings/") driver.get(ConfigReader.readconfigData("section1", "Application_URL")) driver.maximize_window() return driver
def before_scenario(context, scenario): if ((ConfigReader.readConfigData('Details', 'Browser')) == "Chrome"): path = "./Driver/chromedriver.exe" context.driver = Chrome(executable_path=path) elif ((ConfigReader.readConfigData('Details', 'Browser')) == "Firefox"): path = "./Driver/geckodriver.exe" context.driver = Firefox(executable_path=path) elif ((ConfigReader.readConfigData('Details', 'Browser')) == "Ie"): path = "./Driver/IEDriverServer.exe" context.driver = Ie(executable_path=path) else: path = "./Driver/chromedriver.exe" context.driver = Chrome(executable_path=path) context.driver.maximize_window() context.driver.implicitly_wait(100) context.driver.get( ConfigReader.readConfigData('Details', 'Application_URL'))
def start_Browser(): global driver if ((ConfigReader.readConfigData('Details', 'Browser')) == "Chrome"): path = "./Driver/chromedriver.exe" driver = Chrome(executable_path=path) elif ((ConfigReader.readConfigData('Details', 'Browser')) == "Firefox"): path = "./Driver/geckodriver.exe" driver = Firefox(executable_path=path) elif ((ConfigReader.readConfigData('Details', 'Browser')) == "ie"): path = "./Driver/IEDriverServer.exe" driver = ie(executable_path=path) else: path = "./Driver/chromedriver.exe" driver = Chrome(executable_path=path) driver.maximize_window() driver.implicitly_wait(100) driver.get(ConfigReader.readConfigData('Details', 'Application_URL')) return driver