예제 #1
0
    def test_register(self):
        self.sub_setUp()
        self.driver.find_element_by_name('userName').send_keys('15757856712')
        time.sleep(2)
        self.driver.find_element_by_name('password').send_keys('mao123456')
        time.sleep(2)
        self.driver.find_element_by_id('loginBtn').click()
        time.sleep(2)
        #self.driver.maximize_window()
        self.driver.maximize_window()
        # 先定位到搜索输入框
        # 通过id或name定位即可
        self.driver.find_element_by_link_text("贷前管理").click()
        time.sleep(1)
        self.driver.find_element_by_link_text("资信管理").click()
        time.sleep(1)
        self.driver.switch_to_frame('iframe_26')
        ele = self.driver.find_element_by_id("launchedCredit")
        ele.click()
        time.sleep(1)
        self.driver.switch_to.default_content()
        self.driver.switch_to_frame('iframe_undefined')
        ele = self.driver.find_element_by_name("customerName")
        cusname = utils.generator.random_name()
        ele.send_keys(cusname)
        shenfen = randomphone.gennerator()
        self.driver.find_element_by_id("cardNo").send_keys(shenfen)
        time.sleep(2)
        Select(self.driver.find_element_by_id(
            "bankDeraler")).select_by_visible_text("工行安徽城建支行")
        time.sleep(2)
        Select(self.driver.find_element_by_id(
            "maritalStatus")).select_by_visible_text("已婚")
        phone = utils.generator.random_phone_number()
        self.driver.find_element_by_name("relavants[0].mobile").send_keys(
            phone)
        ele = self.driver.find_element_by_id("save")
        ele.click()
        time.sleep(1)
        self.driver.find_element_by_id("sureOption").click()
        time.sleep(2)

        self.driver.find_element_by_xpath(
            "(//input[@name='btSelectItem'])[4]").click()
        self.driver.find_element_by_xpath(
            "(//*[@id='task']/div/div/div[3]/div/button[1])").click()
예제 #2
0
 def testCase3(self):
     #生成随机姓名与证件号
     driver.switch_to.default_content()
     driver.switch_to_frame('iframe_undefined')
     ele = driver.find_element_by_name("customerName")
     shenfen = randomphone.gennerator()
     name = randomphone.randomname1()
     driver.find_element_by_id("cardNo").send_keys(shenfen)
     # driver.find_element_by_id("cardNo").send_keys("5646132")  固定输入,验证alert
     Select(driver.find_element_by_id(
         "bankDeraler")).select_by_visible_text(u"工行安徽城建支行")
     Select(driver.find_element_by_id(
         "maritalStatus")).select_by_visible_text("未婚")
     phone = randomphone.createPhone()
     driver.find_element_by_name("relavants[0].mobile").send_keys(phone)
     sleep(1)
     driver.find_element_by_name("customerName").send_keys(name)
     print "客户生成成功!"
     sleep(3)
예제 #3
0
    driver.maximize_window()
    sleep(1)
    #先定位到搜索输入框
    #通过id或name定位即可
    driver.find_element_by_link_text("贷前管理").click()
    sleep(1)
    driver.find_element_by_link_text("资信管理").click()
    sleep(1)
    driver.switch_to_frame('iframe_26')
    ele = driver.find_element_by_id("launchedCredit")
    ele.click()
    sleep(2)
    driver.switch_to.default_content()
    driver.switch_to_frame('iframe_undefined')
    ele = driver.find_element_by_name("customerName")
    shenfen = randomphone.gennerator()
    def random_name(size=1, chars=string.ascii_letters + string.digits):
        return ''.join(random.choice(chars) for _ in range(size))


    def first_name(size=2, ln=None, fn=None):
        _lst = []
        for i in range(size):
            _item = random_name(1, fn)
            if ln:
                while _item in ln:
                    _item = random_name(1, fn)
                _lst.append(_item)
            else: 
                _lst.append(_item)
        return "".join(_lst)