热线电话:13121318867

登录
2019-04-15 阅读量: 701
如何使用Python进行非阻塞等待(1)

先决条件:安装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)

66.6667
2
关注作者
收藏
评论(0)

发表评论

暂无数据
推荐帖子