如何通过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()
Selenium本身不提供任何api来读取或写入文件
这些操作应该使用python代码(或者您必须选择脚本的任何编程语言)来完成
下面是一个链接,它解释了使用python的文件操作 https://www.programiz.com/python-programming/file-operation
此外,我建议将数据存储在JSON/CSV/XLSX中
相关问题 更多 >
编程相关推荐