class UploadAndPhoto(object): findBy = "xpath" fld_upload = "//*[@id='root']/div/div/div/div[4]/div[2]/div/div[2]" \ "/div/div[2]/div/div[2]/div/div[2]/div[2]/div/div[1]" btn_take_photo = "//span[contains(text(), 'Take Photo')]" btn_capture = "//span[contains(text(), 'Capture')]" photoSample = "D:\\sample.jpg" def __init__(self, driver): self.driver = driver self.run = MakeAction(driver) def uploadPhoto(self, ntime: int): time.sleep(ntime) self.run.find_element_and_input(self.findBy, self.fld_upload, 1, self.photoSample) time.sleep(ntime) def takePhoto(self, ntime: int): time.sleep(ntime) self.run.click_element(self.findBy, self.btn_take_photo) time.sleep(ntime) self.run.click_element(self.findBy, self.btn_capture)
class Login(object): findBy = 'xpath' fld_username = "******" fld_password = "******" fld_btnLogin = "******" def __init__(self, driver): self.driver = driver self.run = MakeAction(driver) self.otp = Otp(driver) def setUsername(self, username): time.sleep(2) self.run.find_element_and_input(self.findBy, self.fld_username, 3, username) def setPassword(self, password): time.sleep(2) self.run.find_element_and_input(self.findBy, self.fld_password, 3, password) def clickLogin(self): time.sleep(2) self.run.click_element(self.findBy, self.fld_btnLogin, 3) def login(self, username, password): self.setUsername(username) self.setPassword(password) self.clickLogin() self.otp.run_otp() time.sleep(5)
class Login(object): findBy = 'xpath' findByTag = 'tag_name' fld_username = "******" fld_password = "******" fld_btnLogin = "******" tag_for_scroll = 'body' def __init__(self, driver): self.driver = driver self.run = MakeAction(driver) self.otp = Otp(driver) def setUsername(self, username): time.sleep(2) self.run.find_element_and_input(self.findBy, self.fld_username, 1, username) def setPassword(self, password): time.sleep(2) self.run.find_element_and_input(self.findBy, self.fld_password, 1, password) def clickLogin(self): time.sleep(2) self.run.click_element(self.findBy, self.fld_btnLogin, 1) def setScrollDown(self): self.run.web_scroll("down", self.findByTag, self.tag_for_scroll) def setScrollUp(self): self.run.web_scroll("up", self.findByTag, self.tag_for_scroll) def login(self, username, password): # self.setScrollDown() # time.sleep(5) self.setUsername(username) self.setPassword(password) self.clickLogin() self.otp.run_otp()
class ReuseGlobal(object): findBy = "xpath" findByTag = "tag_name" tag_for_scroll = "body" def __init__(self, driver): self.driver = driver self.run = MakeAction(driver) self.photo = UploadAndPhoto(driver) self.sender = Sender self.receiver = Receiver self.maker = Maker self.other = Others def setScrollDown(self): self.run.web_scroll("down", self.findByTag, self.tag_for_scroll) def setScrollUp(self): self.run.web_scroll("up", self.findByTag, self.tag_for_scroll) def setBirthdate(self): self.run.click_element(self.findBy, self.sender.fld_birthday) self.run.click_element(self.findBy, self.sender.fld_year) self.run.click_element(self.findBy, self.sender.fld_year_specific) self.run.click_element(self.findBy, self.sender.fld_date) def clickOk(self): self.run.click_element(self.findBy, self.other.btn_ok) def clickDone(self): self.run.click_element(self.findBy, self.other.btn_done) def clickNext(self, ntime: int): time.sleep(ntime) self.run.click_element(self.findBy, self.other.btn_next) time.sleep(ntime) def clickBack(self, ntime: int): time.sleep(ntime) self.run.click_element(self.findBy, self.other.btn_back) time.sleep(ntime) def clickSearchButton(self, ntime: int): self.run.click_element(self.findBy, self.other.btn_search) self.searchClient(ntime) time.sleep(ntime) def searchClient(self, ntime: int): self.run.find_element_and_input(self.findBy, self.other.fld_search, 1, "t") self.run.find_element_and_input(self.findBy, self.other.fld_search, 1, Keys.ENTER) time.sleep(ntime)
class MakerForm(object): findBy = "xpath" findByTag = "tag_name" tag_for_scroll = "body" def __init__(self, driver): self.driver = driver self.run = MakeAction(driver) self.photo = UploadAndPhoto(driver) self.sender = Sender self.receiver = Receiver self.maker = Maker self.other = Others def clickWallet(self): self.run.click_element(self.findBy, self.maker.tab_wallet) def clickNRPS(self): self.run.click_element(self.findBy, self.maker.tab_nrps) def clickSendMoney(self): self.run.click_element(self.findBy, self.maker.panel_sendMoney) def clickPanelWallet(self): self.run.click_element(self.findBy, self.maker.panel_wallet) def clickPanelInstapay(self): self.run.click_element(self.findBy, self.maker.panel_instapay) def clickPanelPesonet(self): self.run.click_element(self.findBy, self.maker.panel_pesonet) def detailsAndPhoto(self): self.run.click_element(self.findBy, self.maker.tab_details) def details(self): self.run.click_element(self.findBy, self.receiver.tab_details) def clickCancel(self): pass
class TransMakerPesonet(object): findBy = "xpath" def __init__(self, driver): self.driver = driver self.receiver = Receiver self.sender = Sender self.other = Others self.makerForm = MakerForm(driver) self.run = MakeAction(driver) self.reuse = ReuseGlobal(driver) def selectPesonetTransaction(self): self.run.capture_screen("Pesonet Transaction") self.makerForm.clickNRPS() self.makerForm.clickSendMoney() time.sleep(2) self.makerForm.clickPanelPesonet() def setSenderInfo(self): self.run.find_element_and_input(self.findBy, self.sender.fld_accountSender, 1, "101400001643") self.run.find_element_and_input(self.findBy, self.sender.fld_lastname, 1, "Dela Cruz") self.run.find_element_and_input(self.findBy, self.sender.fld_firstname, 1, "Juan") self.run.find_element_and_input(self.findBy, self.sender.fld_middlename, 1, "Automated") self.run.find_element_and_input(self.findBy, self.sender.fld_address, 1, "#18 Sample Address,") time.sleep(1) self.run.find_element_and_input(self.findBy, self.sender.fld_mobile, 1, "9517284928") time.sleep(1) self.run.click_element(self.findBy, self.sender.fld_gender) self.run.click_element(self.findBy, self.sender.fld_gender_specific) time.sleep(1) self.run.click_element(self.findBy, self.sender.fld_area) self.run.click_element(self.findBy, self.sender.fld_area_specific) time.sleep(1) self.run.click_element(self.findBy, self.sender.fld_barangay) self.run.click_element(self.findBy, self.sender.fld_barangay_specific) time.sleep(1) self.reuse.clickNext(1) def setReceiverInfo(self): self.run.click_element(self.findBy, self.receiver.fld_bank) self.run.click_element(self.findBy, self.receiver.fld_bank_specific) time.sleep(2) self.run.find_element_and_input(self.findBy, self.receiver.fld_accountReceiver, 1, "101400001643") self.run.find_element_and_input(self.findBy, self.receiver.fld_lastname, 1, "Dela Cruz") self.run.find_element_and_input(self.findBy, self.receiver.fld_firstname, 1, "Juan") self.run.find_element_and_input(self.findBy, self.receiver.fld_middlename, 1, "Automated") self.run.find_element_and_input(self.findBy, self.receiver.fld_address, 1, "#18 Sample Address,") time.sleep(1) self.run.find_element_and_input(self.findBy, self.receiver.fld_mobile, 1, "9517284928") time.sleep(1) self.run.click_element(self.findBy, self.receiver.fld_gender) self.run.click_element(self.findBy, self.receiver.fld_gender_specific) time.sleep(1) self.run.click_element(self.findBy, self.receiver.fld_area) self.run.click_element(self.findBy, self.receiver.fld_area_specific) time.sleep(1) self.run.click_element(self.findBy, self.receiver.fld_barangay) self.run.click_element(self.findBy, self.receiver.fld_barangay_specific) time.sleep(1) self.reuse.clickNext(1) time.sleep(5) def searchClient(self): self.reuse.clickSearchButton(1) def makePesonetTransaction(self): self.selectPesonetTransaction() self.setSenderInfo() self.reuse.setScrollUp() self.reuse.setScrollDown() self.setReceiverInfo()
class TransMakerWallet(object): now = datetime.datetime.now() year = str(now.year) date = str(now.day) findBy = "xpath" findByTag = "tag_name" tag_for_scroll = "body" def __init__(self, driver): self.driver = driver self.run = MakeAction(driver) self.photo = UploadAndPhoto(driver) self.reuse = ReuseGlobal(driver) self.sender = Sender self.receiver = Receiver self.maker = Maker self.amount = AmountAndPurpose self.other = Others self.makerForm = MakerForm(driver) def setSenderInfo(self): self.run.find_element_and_input(self.findBy, self.sender.fld_lastname, 1, "Dela Cruz") self.run.find_element_and_input(self.findBy, self.sender.fld_firstname, 1, "Juan") self.run.find_element_and_input(self.findBy, self.sender.fld_middlename, 1, "Automated") self.run.find_element_and_input(self.findBy, self.sender.fld_address, 1, "#18 Sample Address,") self.run.click_element(self.findBy, self.sender.fld_area) self.run.click_element(self.findBy, self.sender.fld_area_specific) time.sleep(1) self.run.click_element(self.findBy, self.sender.fld_barangay) self.run.click_element(self.findBy, self.sender.fld_barangay_specific) time.sleep(1) self.run.click_element(self.findBy, self.sender.fld_nationality) self.run.click_element(self.findBy, self.sender.fld_nationality_specific) time.sleep(1) self.run.find_element_and_input(self.findBy, self.sender.fld_mobile, 1, "9517284928") time.sleep(1) self.run.click_element(self.findBy, self.sender.fld_gender) self.run.click_element(self.findBy, self.sender.fld_gender_specific) time.sleep(1) self.reuse.setBirthdate() self.run.find_element_and_input(self.findBy, self.sender.fld_birthPlace, 1, "Sample City") time.sleep(1) self.reuse.setScrollDown() time.sleep(1) self.run.click_element(self.findBy, self.sender.fld_ID) self.run.click_element(self.findBy, self.sender.fld_ID_specific) time.sleep(2) self.run.find_element_and_input(self.findBy, self.sender.fld_ID_number, 1, "123123") time.sleep(1) self.run.click_element(self.findBy, self.sender.fld_funds) self.run.click_element(self.findBy, self.sender.fld_funds_specific) time.sleep(1) self.run.find_element_and_input(self.findBy, self.sender.fld_email, 1, "*****@*****.**") time.sleep(1) self.run.capture_screen("Sender Details") def setReceiverInfo(self): self.run.find_element_and_input(self.findBy, self.receiver.fld_lastname, 1, "Yom") self.run.find_element_and_input(self.findBy, self.receiver.fld_firstname, 1, "Yom") self.run.find_element_and_input(self.findBy, self.receiver.fld_middlename, 1, "Yom") self.run.find_element_and_input(self.findBy, self.sender.fld_mobile, 1, "9517284928") def setAmountAndPurpose(self): self.run.find_element_and_input(self.findBy, self.amount.fld_amount, 1, "1000") self.run.find_element_and_input(self.findBy, self.amount.fld_beneficiary, 1, "Brader") time.sleep(1) self.run.click_element(self.findBy, self.amount.fld_purpose) self.run.click_element(self.findBy, self.amount.fld_purpose_specific) time.sleep(1) self.reuse.setScrollDown() def confirmationPage(self): time.sleep(1) self.reuse.setScrollUp() self.run.capture_screen("Confirmation Page - Top") time.sleep(1) self.reuse.setScrollDown() self.run.capture_screen("Confirmation Page - Bottom") def selectWalletTransaction(self): self.run.capture_screen("Wallet Transaction") self.makerForm.clickWallet() self.makerForm.clickSendMoney() self.makerForm.clickPanelWallet() self.makerForm.detailsAndPhoto() time.sleep(4) def settingUpSender(self): self.setSenderInfo() self.reuse.clickNext(2) self.photo.takePhoto(2) self.reuse.clickNext(2) def settingUpReceiver(self): time.sleep(2) self.reuse.setScrollUp() time.sleep(1) self.makerForm.details() self.setReceiverInfo() self.reuse.clickNext(1) self.setAmountAndPurpose() self.reuse.clickNext(1) def checkConfirmationPage(self): self.confirmationPage() self.reuse.clickNext(1) self.reuse.clickOk() time.sleep(8) def checkReceiptPage(self): self.run.capture_screen("Receipt Page") time.sleep(1) self.run.click_element(self.findBy, self.other.btn_done) time.sleep(3) def makeWalletTransaction(self): self.selectWalletTransaction() self.settingUpSender() self.settingUpReceiver() self.checkConfirmationPage() self.checkReceiptPage()