如何通过python从selenium中的外部txt或exel文件中获取用户名和密码字段

2024-09-30 06:31:46 发布

您现在位置:Python中文网/ 问答频道 /正文

如何通过python从selenium中的外部txt exel文件获取facebook中的用户名和密码字段

username = 'How To Fectch From External Txt File?'
passowrd = 'How To Fectch From External Txt File?'

emailInput = driver.find_element_by_id("email")
passwordInput = driver.find_element_by_id("pass")
loginButton = driver.find_element_by_xpath("//form/table/tbody/tr/td/label/input")

ActionChains(driver) \
    .move_to_element(emailInput) \
    .click() \
    .send_keys(username) \
    .perform()

ActionChains(driver) \
    .move_to_element(passwordInput) \
    .click() \
    .send_keys(passowrd) \
    .perform()

ActionChains(driver) \
    .move_to_element(loginButton) \
    .click() \
    .perform()


Tags: tofrommovebydriverusernameelementfind

热门问题