def no_auth(self, login, password): try: rules(1, login) lang = 0 while lang < 3: try: if lang == 0: self.driver.find_element_by_id('Remember login?') elif lang == 1: self.driver.find_element_by_id('Запомнить логин?') elif lang == 2: self.driver.find_element_by_id("Запам'ятати логін?") break except: lang += 1 try: # login(self, lang) login_planshet(self, login, password, lang) except NoSuchElementException: pass if lang == 0: self.assertTrue( self.driver.find_element_by_id( "It is impossible to log in to the system, because you do not have rights to enter the system." )) elif lang == 1: self.assertTrue( self.driver.find_element_by_id( 'Подключение к системе невозможно, так как у вас нет прав на вход в систему.' )) elif lang == 2: self.assertTrue( self.driver.find_element_by_id( 'Підключення до системи неможливе, у вас немає прав на вхід у систему.' )) except: directory = '%s/screenshots/' % os.getcwd() file_name = 'test_14.png' self.driver.save_screenshot(directory + file_name) raise finally: rules(1, login)
def rule_20(self, login, password): try: rules(20, login) lang = 0 while lang < 3: try: if lang == 0: self.driver.find_element_by_id('Remember login?') elif lang == 1: self.driver.find_element_by_id('Запомнить логин?') elif lang == 2: self.driver.find_element_by_id("Запам'ятати логін?") break except: lang += 1 try: # login(self, lang) login_planshet(self, login, password, lang) except NoSuchElementException: pass if lang == 0: self.assertTrue( self.driver.find_element_by_id( "The user doesn't have enough rights to finish the action") ) elif lang == 1: self.assertTrue( self.driver.find_element_by_id( 'У пользователя недостаточно прав для завершения данного действия' )) elif lang == 2: self.assertTrue( self.driver.find_element_by_id( 'У користувача недостатньо прав для завершення даної дії')) except: directory = '%s/screenshots/' % os.getcwd() file_name = 'test_15.png' self.driver.save_screenshot(directory + file_name) raise finally: rules(20, login)
def rule_46(self, login, password): try: rules(46, login) lang = 0 while lang < 3: try: if lang == 0: self.driver.find_element_by_id('Remember login?') elif lang == 1: self.driver.find_element_by_id('Запомнить логин?') elif lang == 2: self.driver.find_element_by_id("Запам'ятати логін?") break except: lang += 1 # login(self, lang) login_planshet(self, login, password, lang) if lang == 0: self.driver.implicitly_wait(15) try: allert = self.driver.find_element_by_id('No') allert.click() except NoSuchElementException: pass menu = self.driver.find_element_by_id('homePage') menu.click() try: self.driver.find_element_by_id('Cards') raise NameError('Cards present') except NoSuchElementException: return True elif lang == 1: self.driver.implicitly_wait(15) try: allert = self.driver.find_element_by_id('Нет') allert.click() except NoSuchElementException: pass menu = self.driver.find_element_by_id('homePage') menu.click() try: self.driver.find_element_by_id('Карты') raise NameError('Cards present') except NoSuchElementException: return True elif lang == 2: self.driver.implicitly_wait(15) try: allert = self.driver.find_element_by_id('Ні') allert.click() except NoSuchElementException: pass menu = self.driver.find_element_by_id('homePage') menu.click() try: self.driver.find_element_by_id('Картки') raise NameError('Cards present') except NoSuchElementException: return True except: directory = '%s/screenshots/' % os.getcwd() file_name = 'test_22.png' self.driver.save_screenshot(directory + file_name) raise finally: rules(46, login)
def rule_18(self, login, password): try: rules(18, login) try: self.driver.find_element_by_id('Cancel').click() except NoSuchElementException: pass lang = 0 while lang < 3: try: if lang == 0: self.driver.find_element_by_id('Remember login?') elif lang == 1: self.driver.find_element_by_id('Запомнить логин?') elif lang == 2: self.driver.find_element_by_id("Запам'ятати логін?") break except: lang += 1 # login(self, lang) login_planshet(self, login, password, lang) if lang == 0: self.driver.implicitly_wait(30) try: allert = self.driver.find_element_by_id('No') allert.click() except NoSuchElementException: pass menu = self.driver.find_element_by_id('homePage') menu.click() bil = self.driver.find_element_by_id('Transfers') bil.click() new_trans = self.driver.find_element_by_id('New transfers') new_trans.click() scheta = self.driver.find_element_by_id('Between own accounts') scheta.click() new_schet = self.driver.find_element_by_id('New') new_schet.click() sleep(3) self.driver.find_element_by_id('Done').click() sleep(3) sp = self.driver.find_elements_by_xpath('//XCUIElementTypeCell') sp.remove(sp[len(sp) - 1]) for i in sp: try: w = i.find_element_by_xpath( '//XCUIElementTypeCell/XCUIElementTypeStaticText[3]') except NoSuchElementException: print i.find_element_by_xpath( '//XCUIElementTypeCell').get_attribute('name') print 'exception time' w1 = i.find_element_by_xpath( '//XCUIElementTypeCell/XCUIElementTypeStaticText[1]') if not re.findall(r'\d+\.\d{2}\s\w{3}', w.get_attribute('name')): print re.findall(r'\d+\.\d{2}\s\w{3}', w.get_attribute('name')) self.assertTrue( re.findall(r'\s\w{3}', w1.get_attribute('name')) [0].lstrip(' ') == 'UAH') elif not re.findall(r'\d+\.\d{2}\s\w{3}', w1.get_attribute('name')): print re.findall(r'\d+\.\d{2}\s\w{3}', w.get_attribute('name')) self.assertTrue( re.findall(r'\s\w{3}', w.get_attribute('name')) [0].lstrip(' ') == 'UAH') account = self.driver.find_element_by_id('From account') account.click() sleep(3) self.driver.find_element_by_id('Done').click() sleep(3) spisok2 = self.driver.find_elements_by_xpath( '//XCUIElementTypeCell') spisok2.remove(spisok2[len(spisok2) - 1]) for i in spisok2: w = i.find_element_by_xpath( '//XCUIElementTypeCell/XCUIElementTypeStaticText[3]') w1 = i.find_element_by_xpath( '//XCUIElementTypeCell/XCUIElementTypeStaticText[1]') if not re.findall(r'\d+\.\d{2}\s\w{3}', w.get_attribute('name')): print re.findall(r'\d+\.\d{2}\s\w{3}', w.get_attribute('name')) self.assertTrue( re.findall(r'\s\w{3}', w1.get_attribute('name')) [0].lstrip(' ') == 'UAH') elif not re.findall(r'\d+\.\d{2}\s\w{3}', w1.get_attribute('name')): print re.findall(r'\d+\.\d{2}\s\w{3}', w.get_attribute('name')) self.assertTrue( re.findall(r'\s\w{3}', w.get_attribute('name')) [0].lstrip(' ') == 'UAH') elif lang == 1: self.driver.implicitly_wait(30) try: allert = self.driver.find_element_by_id('Нет') allert.click() except NoSuchElementException: pass menu = self.driver.find_element_by_id('homePage') menu.click() bil = self.driver.find_element_by_id('Переводы') bil.click() new_trans = self.driver.find_element_by_id('Новый платеж') new_trans.click() scheta = self.driver.find_element_by_id('Между своими счетами') scheta.click() new_schet = self.driver.find_element_by_id('Новый') new_schet.click() sleep(3) self.driver.find_element_by_id('Done').click() sleep(3) sp = self.driver.find_elements_by_xpath('//XCUIElementTypeCell') sp.remove(sp[len(sp) - 1]) for i in sp: try: w = i.find_element_by_xpath( '//XCUIElementTypeCell/XCUIElementTypeStaticText[3]') except NoSuchElementException: print i.find_element_by_xpath( '//XCUIElementTypeCell').get_attribute('name') print 'exception time' w1 = i.find_element_by_xpath( '//XCUIElementTypeCell/XCUIElementTypeStaticText[1]') if not re.findall(r'\d+\.\d{2}\s\w{3}', w.get_attribute('name')): print re.findall(r'\d+\.\d{2}\s\w{3}', w1.get_attribute('name')) self.assertTrue( re.findall(r'\s\w{3}', w1.get_attribute('name')) [0].lstrip(' ') == 'UAH') elif not re.findall(r'\d+\.\d{2}\s\w{3}', w1.get_attribute('name')): print re.findall(r'\d+\.\d{2}\s\w{3}', w.get_attribute('name')) self.assertTrue( re.findall(r'\s\w{3}', w.get_attribute('name')) [0].lstrip(' ') == 'UAH') account = self.driver.find_element_by_id('Со счета') account.click() sleep(3) self.driver.find_element_by_id('Done').click() sleep(3) spisok2 = self.driver.find_elements_by_xpath( '//XCUIElementTypeCell') spisok2.remove(spisok2[len(spisok2) - 1]) for i in spisok2: w = i.find_element_by_xpath( '//XCUIElementTypeCell/XCUIElementTypeStaticText[3]') w1 = i.find_element_by_xpath( '//XCUIElementTypeCell/XCUIElementTypeStaticText[1]') if not re.findall(r'\d+\.\d{2}\s\w{3}', w.get_attribute('name')): print re.findall(r'\d+\.\d{2}\s\w{3}', w.get_attribute('name')) self.assertTrue( re.findall(r'\s\w{3}', w1.get_attribute('name')) [0].lstrip(' ') == 'UAH') elif not re.findall(r'\d+\.\d{2}\s\w{3}', w1.get_attribute('name')): print re.findall(r'\d+\.\d{2}\s\w{3}', w.get_attribute('name')) self.assertTrue( re.findall(r'\s\w{3}', w.get_attribute('name')) [0].lstrip(' ') == 'UAH') elif lang == 2: self.driver.implicitly_wait(30) try: allert = self.driver.find_element_by_id('Ні') allert.click() except NoSuchElementException: pass menu = self.driver.find_element_by_id('homePage') menu.click() bil = self.driver.find_element_by_id('Перекази') bil.click() new_trans = self.driver.find_element_by_id('Новий переказ') new_trans.click() scheta = self.driver.find_element_by_id('Між своїми рахунками') scheta.click() new_schet = self.driver.find_element_by_id('Новий') new_schet.click() sleep(3) self.driver.find_element_by_id('Done').click() sleep(3) sp = self.driver.find_elements_by_xpath('//XCUIElementTypeCell') sp.remove(sp[len(sp) - 1]) cur = [] for i in sp: try: w = i.find_element_by_xpath( '//XCUIElementTypeCell/XCUIElementTypeStaticText[3]') except NoSuchElementException: print i.find_element_by_xpath( '//XCUIElementTypeCell').get_attribute('name') print 'exception time' w1 = i.find_element_by_xpath( '//XCUIElementTypeCell/XCUIElementTypeStaticText[1]') if not re.findall(r'\d+\.\d{2}\s\w{3}', w.get_attribute('name')): print re.findall(r'\d+\.\d{2}\s\w{3}', w.get_attribute('name')) self.assertTrue( re.findall(r'\s\w{3}', w1.get_attribute('name')) [0].lstrip(' ') == 'UAH') elif not re.findall(r'\d+\.\d{2}\s\w{3}', w1.get_attribute('name')): print re.findall(r'\d+\.\d{2}\s\w{3}', w.get_attribute('name')) self.assertTrue( re.findall(r'\s\w{3}', w.get_attribute('name')) [0].lstrip(' ') == 'UAH') account = self.driver.find_element_by_id('З рахунку') account.click() sleep(3) self.driver.find_element_by_id('Done').click() sleep(3) spisok2 = self.driver.find_elements_by_xpath( '//XCUIElementTypeCell') spisok2.remove(spisok2[len(spisok2) - 1]) for i in spisok2: w = i.find_element_by_xpath( '//XCUIElementTypeCell/XCUIElementTypeStaticText[3]') w1 = i.find_element_by_xpath( '//XCUIElementTypeCell/XCUIElementTypeStaticText[1]') if not re.findall(r'\d+\.\d{2}\s\w{3}', w.get_attribute('name')): print re.findall(r'\d+\.\d{2}\s\w{3}', w.get_attribute('name')) self.assertTrue( re.findall(r'\s\w{3}', w1.get_attribute('name')) [0].lstrip(' ') == 'UAH') elif not re.findall(r'\d+\.\d{2}\s\w{3}', w1.get_attribute('name')): print re.findall(r'\d+\.\d{2}\s\w{3}', w.get_attribute('name')) self.assertTrue( re.findall(r'\s\w{3}', w.get_attribute('name')) [0].lstrip(' ') == 'UAH') except: directory = '%s/screenshots/' % os.getcwd() file_name = 'test_18.png' self.driver.save_screenshot(directory + file_name) raise finally: rules(18, login)
def rule_82(self, login, password): try: rules(82, login) lang = 0 while lang < 3: try: if lang == 0: self.driver.find_element_by_id('Remember login?') elif lang == 1: self.driver.find_element_by_id('Запомнить логин?') elif lang == 2: self.driver.find_element_by_id("Запам'ятати логін?") break except: lang += 1 # login(self, lang) login_planshet(self, login, password, lang) if lang == 0: self.driver.implicitly_wait(15) try: allert = self.driver.find_element_by_id('No') allert.click() except NoSuchElementException: pass try: self.driver.find_element_by_id('OPEN DEPOSIT') raise NameError('Deposit can been open') except NoSuchElementException: return True elif lang == 1: self.driver.implicitly_wait(15) try: allert = self.driver.find_element_by_id('Нет') allert.click() except NoSuchElementException: pass try: self.driver.find_element_by_id('ОТКРЫТЬ ДЕПОЗИТ') raise NameError('Deposit can been open') except NoSuchElementException: return True elif lang == 2: self.driver.implicitly_wait(15) try: allert = self.driver.find_element_by_id('Ні') allert.click() except NoSuchElementException: pass try: self.driver.find_element_by_id('ВІДКРИТИ ДЕПОЗИТ') raise NameError('Deposit can been open') except NoSuchElementException: return True except: directory = '%s/screenshots/' % os.getcwd() file_name = 'test_23.png' self.driver.save_screenshot(directory + file_name) raise finally: rules(82, login)
def cards_disable(self, login, password): try: rules(46, login) lang = 0 while lang < 3: try: if lang == 0: self.driver.find_element_by_id('Remember login?') elif lang == 1: self.driver.find_element_by_id('Запомнить логин?') elif lang == 2: self.driver.find_element_by_id("Запам'ятати логін?") break except: lang += 1 # login(self, lang) login_planshet(self, login, password, lang) if lang == 0: self.driver.implicitly_wait(10) try: allert = self.driver.find_element_by_id('No') allert.click() except NoSuchElementException: pass sleep(4) try: cards = self.driver.find_element_by_xpath( '/XCUIElementTypeApplication/XCUIElementTypeWindow/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeTable/XCUIElementTypeOther[2]/XCUIElementTypeStaticText[3]' ) s = cards.get_attribute('name') if s.split(' ')[0].encode('utf-8') == 'CARDS': raise NameError('Cards present') else: return True except NoSuchElementException: return True elif lang == 1: self.driver.implicitly_wait(10) try: allert = self.driver.find_element_by_id('Нет') allert.click() except NoSuchElementException: pass sleep(4) try: cards = self.driver.find_element_by_xpath( '/XCUIElementTypeApplication/XCUIElementTypeWindow/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeTable/XCUIElementTypeOther[2]/XCUIElementTypeStaticText[3]' ) s = cards.get_attribute('name') if s.split(' ')[0].encode('utf-8') == 'КАРТЫ': raise NameError('Cards present') else: return True except NoSuchElementException: return True elif lang == 2: self.driver.implicitly_wait(5) try: allert = self.driver.find_element_by_id('Ні') allert.click() except NoSuchElementException: pass sleep(4) try: cards = self.driver.find_element_by_xpath( '/XCUIElementTypeApplication/XCUIElementTypeWindow/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeTable/XCUIElementTypeOther[2]/XCUIElementTypeStaticText[3]' ) s = cards.get_attribute('name') if s.split(' ')[0].encode('utf-8') == 'КАРТИ': raise NameError('Cards present') else: return True except NoSuchElementException: return True except: directory = '%s/screenshots/' % os.getcwd() file_name = 'test_22.png' self.driver.save_screenshot(directory + file_name) raise finally: rules(46, login)
def rule_17and18(self, login, password): try: rules(17, login) rules(18, login) lang = 0 while lang < 3: try: if lang == 0: self.driver.find_element_by_id('Remember login?') elif lang == 1: self.driver.find_element_by_id('Запомнить логин?') elif lang == 2: self.driver.find_element_by_id("Запам'ятати логін?") break except: lang += 1 # login(self, lang) login_planshet(self, login, password, lang) if lang == 0: self.driver.implicitly_wait(15) try: allert = self.driver.find_element_by_id('No') allert.click() except NoSuchElementException: pass menu = self.driver.find_element_by_id('homePage') menu.click() bil = self.driver.find_element_by_id('Transfers') bil.click() new_trans = self.driver.find_element_by_id('New transfers') new_trans.click() try: self.driver.find_element_by_id('Between own accounts') raise NameError('Payments present') except NoSuchElementException: return True elif lang == 1: self.driver.implicitly_wait(15) try: allert = self.driver.find_element_by_id('Нет') allert.click() except NoSuchElementException: pass menu = self.driver.find_element_by_id('homePage') menu.click() bil = self.driver.find_element_by_id('Переводы') bil.click() new_trans = self.driver.find_element_by_id('Новый платеж') new_trans.click() try: self.driver.find_element_by_id('Между своими счетами') raise NameError('Payments present') except NoSuchElementException: return True elif lang == 2: self.driver.implicitly_wait(15) try: allert = self.driver.find_element_by_id('Ні') allert.click() except NoSuchElementException: pass menu = self.driver.find_element_by_id('homePage') menu.click() bil = self.driver.find_element_by_id('Перекази') bil.click() new_trans = self.driver.find_element_by_id('Новий переказ') new_trans.click() try: self.driver.find_element_by_id('Між своїми рахунками') raise NameError('Payments present') except NoSuchElementException: return True except: directory = '%s/screenshots/' % os.getcwd() file_name = 'test_21.png' self.driver.save_screenshot(directory + file_name) raise finally: rules(17, login) rules(18, login)