先决条件:安装Python并将Selenium作为包与Web驱动程序(.exe文件)一起安装
对于使用Selenium的Python Web Automation,可以通过以下方式实现:
假设您希望通过Web自动化登录GeeksForGeeks并在网页上显示用户名和密码元素时填写登录凭据,而不是等到整个页面加载完毕。
步骤1:
您可以按如下方式配置webdriver:
from selenium import webdriver
options = webdriver.ChromeOptions()
options.add_argument("--start-maximized")
options.add_argument("disable-infobars")
chrome = webdriver.Chrome(the_path_of_webdriver_which_is_an_exe,
chrome_options = options, service_args =['--ignore-ssl-errors = true'])
login_uri = 'https://auth.geeksforgeeks.org/'
username = 'something'
password = 'anything'
username_xpath = '//*[@id ="luser"]'
password_xpath = '//*[@id ="password"]'
sign_in_xpath = '//*[@id ="Login"]/button'
chrome.get(login_uri)








暂无数据