+关注
已关注

分类  

暂无分类

标签  

暂无标签

日期归档  

2019-07(2)

2019-08(89)

2019-09(94)

2019-10(15)

2019-11(5)

python selenium 注册 filfox 钱包

发布于2020-11-02 21:27     阅读(27)     评论(0)     点赞(23)     收藏(4)


0

1

2

3

4

5

6

注册 filfox 钱包

在这里插入图片描述

from selenium import webdriver
from selenium.webdriver.support.wait import WebDriverWait
import threading
import csv
from multiprocessing import Queue

fw = open('data.csv','a',encoding='utf-8',newline='')
writer = csv.writer(fw)
#writer.writerow(['Secret_key','address'])

queue_chrome = Queue()
count = 0

def run():

    chrome_options = webdriver.ChromeOptions()
    chrome_options.add_argument('--disable-gpu')

    driver = webdriver.Chrome(options=chrome_options)

    #设置界面
    chrome_para = queue_chrome.get()
    driver.set_window_size(chrome_para[2], chrome_para[3])
    driver.set_window_position(chrome_para[0], chrome_para[1])

    for i in range(30):
        try :
            url = 'https://wallet.filfox.info/zh/password/set'

            driver.get(url)

            input = driver.find_elements_by_xpath('//input[@class="el-input__inner"]')

            # 密码
            input[0].send_keys('12345678')
            input[1].send_keys('12345678')

            # 确定
            driver.find_element_by_xpath(
                '//button[@class=" bg-main rounded-sm flex-grow text-white py-2 hover:bg-buttonHover"]').click()

            # 助记词
            Secret_list = WebDriverWait(driver, timeout=5).until(
                lambda d: d.find_elements_by_xpath('//div[@class="rounded bg-mnemonicBg text-center text-sm px-2 py-1"]')
            )

            # 保存到列表
            list = []
            for key in Secret_list:
                list.append(key.text)

            # 确定
            driver.find_element_by_xpath(
                '//a[@class=" bg-main rounded-sm flex-grow text-white py-2 mt-4 focus:outline-none text-center hover:bg-buttonHover"]').click()

            Secret_key = ''
            # 验证助记词
            for key in list:
                xpath = '//div[@class="grid grid-cols-4 gap-4"]/div[contains(text(),"{}")]'.format(key)

                try:
                    text = WebDriverWait(driver, timeout=5).until(
                        lambda d: d.find_element_by_xpath(xpath)
                    )
                    text.click()
                except Exception:
                    driver.find_element_by_xpath(xpath).click()

                Secret_key = Secret_key + key + ' '

            # 确定
            driver.find_element_by_xpath('//button[@class=" bg-main rounded-sm flex-grow text-white py-2 mt-4 focus:outline-none hover:bg-buttonHover"]').click()

            receive = WebDriverWait(driver, timeout=10).until(
                lambda d: d.find_element_by_xpath('//div[@class="flex justify-between mx-4 mt-4"]//div[contains(text()," 收款 ")]')
            )
            driver.execute_script("arguments[0].click();", receive)

            # 地址
            address = WebDriverWait(driver, timeout=5).until(
                lambda d: d.find_element_by_xpath('//div[@class="text-center font-semibold mt-4"]').text
            )
        except Exception as e:
            print(e)
            continue


        # 保存助记词 地址
        writer.writerow([Secret_key,address])

        global count
        count += 1
        print('次数:',count)

def gen_para():
    x = 1
    y = 1
    long = 475
    high = 300
    # 分辨率
    reslution_x = 1360
    queue_chrome.put([x, y, long, high])
    for i in range(8):
        if (x + long >= reslution_x):
            y = y + high
            x = 1
        else:
            x = x + long
        queue_chrome.put([x, y, long, high])


if __name__ == '__main__':
    gen_para()
    # 多线程
    for i in range(9):
        t = threading.Thread(target=run)
        t.start()

浏览器位置设置是看weixin_38595982作者的selenium多开与浏览器位置大小的设置

0

1

2

3

4



所属网站分类: 技术文章 > 博客

作者:天青色等烟雨

链接: https://www.pythonheidong.com/blog/article/610202/6150303370431d7d67ef/

来源: python黑洞网

任何形式的转载都请注明出处,如有侵权 一经发现 必将追究其法律责任

23 0
收藏该文
已收藏

评论内容:(最多支持255个字符)