def startdriver(): global driver if (Config.readconfig("Details", "Browser") == "Chrome"): caps = DesiredCapabilities().CHROME caps['pageLoadStrategy'] = 'eager' path = "./Drivers/chromedriver.exe" driver = Chrome(executable_path=path) return driver elif (Config.readconfig("Details", "Browser") == "Firefox"): path = "./Drivers/geckodriver.exe" driver = Firefox(executable_path=path) return driver
def start(): global driver driver = Initiate.startdriver() driver.get(Config.readconfig('Details', 'URL')) driver.maximize_window() yield driver = Initiate.closedriver()
def test_dataset(data): driver = Initiate.startdriver() driver.get(Config.readconfig("Details", "URL")) driver.maximize_window() reg = Registration.register(driver) reg.Login("Login") time.sleep(5) reg.Username2(data[0]) reg.Passward2(data[1]) reg.Login2("Login2")
def City(self,City): obj = Select(driver.find_element_by_xpath(Config.elementLoc("RegElements", "City"))) obj.select_by_visible_text("Ranibennur")
def Login2(self,Login2): driver.find_element_by_xpath(Config.elementLoc("RegElements", "Login2")).click()
def Passward2(self,Passward2): driver.find_element_by_xpath(Config.elementLoc("RegElements", "Passward2")).send_keys(Passward2)
def Username2(self,Username2): driver.find_element_by_xpath(Config.elementLoc("RegElements", "Username2")).send_keys(Username2)
def GetURL(self, URL): driver.get(Config.readconfig("Details", "URL")) driver.maximize_window()
def SignUp(self,SignUp): driver.find_element_by_xpath(Config.elementLoc("RegElements", "SignUp")).click()
def Terms(self,Terms): driver.find_element_by_xpath(Config.elementLoc("RegElements", "Terms")).click()
def Cpassward(self, Cpassward): driver.find_element_by_xpath(Config.elementLoc("RegElements", "Cpassward")).send_keys(Cpassward)
def Country(self,Country): obj = Select(driver.find_element_by_xpath(Config.elementLoc("RegElements", "Country"))) obj.select_by_visible_text("India")
def State(self,State): obj = Select(driver.find_element_by_xpath(Config.elementLoc("RegElements", "State"))) obj.select_by_visible_text("Karnataka")
def Sex(self,Sex): obj = Select(driver.find_element_by_xpath(Config.elementLoc("RegElements", "Sex"))) obj.select_by_index(1)
def Scroll(self,Scroll): driver.execute_script(Config.elementLoc("RegElements", "Scroll"))
def Home(self, Home): driver.find_element_by_xpath(Config.elementLoc("RegElements", "Home")).click()
def Phone(self, Phone): driver.find_element_by_xpath(Config.elementLoc("RegElements", "Phone")).send_keys(Phone)
def DOB(self, DOB): driver.find_element_by_xpath(Config.elementLoc("RegElements", "DOB")).send_keys(DOB)
def Zip(self,Zip): driver.find_element_by_xpath(Config.elementLoc("RegElements", "Zip")).send_keys("581115")
def EmailID(self, EmailID): driver.find_element_by_xpath(Config.elementLoc("RegElements", "EmailID")).send_keys(EmailID)