Exemplo n.º 1
0
def get_ip():
    with open("ip.txt", "r", encoding='utf-8') as f:
        txt_lines = f.readlines()
    for txt_line in txt_lines:
        ip = txt_line.strip('\n')
        if servers_chick_ip(ip):
            return ip
        else:
            del_line(ip, 'ip.txt')
            sleep(0.05)
Exemplo n.º 2
0
 def chick_ip(self):
     """
     检测ip是否有效
     :return:
     """
     self.driver.get("https://www.baidu.com/")
     title = self.driver.title
     del_line(self.ip, 'ip.txt')  # 访问百度之后删除ip
     if title == 'www.baidu.com':
         return False
     else:
         return True
Exemplo n.º 3
0
 def liucheng4(self):
     """
     图片6,6-2,7 ,8填写生日 SSN , 和确认提交
     :return:
     """
     print('开始图片第6,6-2,7,8张流程,填写生日 SSN信息等')
     birth_date = self.personal_information_dict.get('生日')  #1985/5/19
     birth_date = birth_date.split('/')
     if len(birth_date[1]) == 1:
         birth_date[1] = '0' + birth_date[1]
     str2 = birth_date[1] + '/' + birth_date[2] + '/' + birth_date[0]
     write(str2, into=S('//*[@id="formRegister:dob"]'))  #生日
     self.save_txt('生日:{}'.format(str2))
     SSN = self.personal_information_dict.get('SSN')
     write(SSN, into=S('//*[@id="formRegister:UIClaimant_social"]'))  #SSN
     self.save_txt('SSN:{}'.format(SSN))
     click(S('//*[@id="formRegister:buttondoAddReg"]'))  #继续
     try:  #监测是否被注册
         wait_until(
             Text('The SSN you provided is already in our records').exists,
             timeout_secs=5,
             interval_secs=0.4)
         print('SSN已被注册,跳过此行数据,从头开始注册')
         self.save_txt('SSN已经被注册,停止流程')
         del_line(self.personal_information_dict.get('驾照号'),
                  self.personal_information_filename)  # 删除个人信息
         sleep(0.15)
         self.information_init()  #从新初始化个人信息
         self.zhuce()
     except:
         pass
     click(S('//*[@id="formRegister:buttondoReg"]'))  # 图片7点击确认
     try:  #监测是否有系统 问题
         wait_until(Text(
             'There was a problem with the system. Please try again later.'
         ).exists,
                    timeout_secs=5,
                    interval_secs=0.4)
         print('系统出现问题。刷新页面重试。')
         self.driver.refresh()
         click(S('//*[@id="formRegister:buttondoReg"]'))  # 图片7点击确认
     except:
         pass
     #图 片8  出现这个表示注册成功
     try:
         print('开始判断页面是否有Your NY GOV Username is字样,最多等待15秒钟')
         wait_until(Text('Your NY GOV Username is:').exists,
                    timeout_secs=15,
                    interval_secs=0.4)
         print('检测成功,注册流程完成')
     except:
         print('没有注册成功')
Exemplo n.º 4
0
def liucheng4():
    """
    图片6,6-2,7 ,8填写生日 SSN , 和确认提交
    :return:
    """
    global personal_information_filename
    global personal_information_dict
    global phone_filename
    global phone_dict
    global email_filename
    global email_dict
    global firse_name
    global last_name
    global email

    print('开始图片第6,6-2,7,8张流程,填写生日 SSN信息等')
    birth_date = personal_information_dict.get('生日')  # 1985/5/19
    birth_date = birth_date.split('/')
    if len(birth_date[1]) == 1:
        birth_date[1] = '0' + birth_date[1]
    str2 = birth_date[1] + '/' + birth_date[2] + '/' + birth_date[0]
    write(str2, into=S('//*[@id="formRegister:dob"]'))  # 生日
    save_txt('生日:{}'.format(str2))
    SSN = personal_information_dict.get('SSN')  # 1985/5/19
    write(SSN, into=S('//*[@id="formRegister:UIClaimant_social"]'))  # SSN
    save_txt('SSN:{}'.format(SSN))
    click(S('//*[@id="formRegister:buttondoAddReg"]'))  # 确认
    try:
        wait_until(
            Text('The SSN you provided is already in our records').exists,
            timeout_secs=5,
            interval_secs=0.4)
        print('SSN已被注册,跳过此行数据,从头开始注册')
        del_line(personal_information_dict.get('驾照号'),
                 personal_information_filename)  # 删除个人信息
        sleep(0.15)

        personal_information_filename = get_filename('.txt', '个人信息')
        personal_information_dict = get_temp_dict(
            personal_information_filename)  # 个人信息
        phone_filename = get_filename('.txt', '个人电话')
        phone_dict = get_phone_dict(phone_filename)  # 个人电话
        email_filename = get_filename('.txt', '个人邮箱')
        email_dict = get_email_dict(email_filename)  # 邮箱
        firse_name = personal_information_dict.get('First 名字')
        last_name = personal_information_dict.get('last 姓')
        email = email_dict.get('邮箱地址')
        zhuce()
    except:
        pass
Exemplo n.º 5
0
 def chick_email(self):
     print('开始检测邮箱是否被注册过,最长6秒没有出现提示,邮箱没问题')
     try:  # 表示邮箱已被注册
         wait_until(Text('This e-mail address was already used for a NY.GOV account').exists, timeout_secs=6,
                    interval_secs=0.4)
         print('此邮箱已被注册 ,自动调整下一个邮箱')
         del_line(self.email,self.email_filename)#删除已被注册过的邮箱
         self.information_init()#重新初始化
         self.email = self.email_dict.get('邮箱地址')#重新获取邮箱地址
         write(self.email, into=S('//*[@id="userEmail"]'))  # E-mail Address
         write(self.email, into=S('//*[@id="userEmailConfirm"]'))  # Confirm E-mail Address
         click(S('//div[contains(@id,"j_id_jsp_")]/div/div/iframe'))  # 点击弹出验证码
         print('请输出验证码,450秒后超时')
         self.chick_yanzhengma()  # 开始检查验证码是否通过
         click(S('//*[@id="buttondoAddReg"]'))  # 点击continue
         chick_email(self)
     except:
         pass
Exemplo n.º 6
0
def liucheng16():
    """
    图片27,28
    :return:
    """
    print('开始图片第27,28张流程')
    click(S('//form[@name="addrNormForm"]/input[@value="Use this address"]'))
    Select(S('//*[@id="DirectDeposit_PaymentOption"]').web_element
           ).select_by_visible_text('Direct Deposit')
    click(S('//input[@value="Continue"]'))  # 点击提交
    print('流程完成,开始清理已使用的信息')
    del_line(personal_information_dict.get('驾照号'),
             personal_information_filename)  #删除个人信息
    print('删除使用过的个人信息完成')
    del_line(email_dict.get('邮箱地址'), email_filename)  #删除个人邮箱
    print('删除使用过的个人邮箱完成')
    del_line(phone_dict.get('电话'), phone_filename)  #删除个人电话
    print('删除使用过的个人电话完成')
    print('剩余流程请手动完成,完成后重启软件')
    write('123', into=S('//*[@id="DirectDeposit_MothersMaidenName"]'))