Python使用selenium进行网页模拟批量登陆

import pandas as pd
import time
from selenium import webdriver
options = webdriver.FirefoxOptions()
    # options.set_headless(True)
    print(i)
    options.add_argument("--headless")  # 设置火狐为headless无界面模式
    options.add_argument("--disable-gpu")
    driver = webdriver.Firefox(options=options)
    driver.get('https://web.ewt360.com/register/#/login')
    time.sleep(2)

    # 输入账号
    input_account = driver.find_element_by_xpath("/html/body/div/div/div/div[2]/div/div[2]/div[1]/div[2]/form/div[3]/span[2]/input")
    input_account.send_keys(i)
    # 输入密码
    input_password = driver.find_element_by_xpath('/html/body/div/div/div/div[2]/div/div[2]/div[1]/div[2]/form/div[4]/span[2]/input')
    input_password.send_keys(123456)
    account_login_button = driver.find_element_by_xpath('/html/body/div/div/div/div[2]/div/div[2]/div[1]/div[2]/form/div[6]/button[1]')
    account_login_button.click()
    time.sleep(1)
    driver.quit()

 

posted @ 2021-08-07 14:31  她与我的点点滴滴  阅读(645)  评论(0)    收藏  举报