예제 #1
0
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)
예제 #2
0
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()