2024-04-19 22:28:08 发布
网友
我试图从LinkedIn网站上获取一些用户资料。在
我使用selenium实现浏览器自动化。在
我需要https://www.linkedin.com/search/results/all/?keywords=director%20supply%20chain&origin=GLOBAL_SEARCH_HEADER&page=1下的所有配置文件
但该网站要求登录详细信息。在
我应该如何在代码中提供我的登录详细信息?在
这个代码正在工作
driver.get("https://www.linkedin.com") driver.implicitly_wait(6) driver.find_element_by_xpath("""//*[@id="login-email"]""").send_keys(userid) driver.find_element_by_xpath("""//*[@id="login-password"]""").send_keys(password) driver.find_element_by_xpath("""//*[@id="login-submit"]""").click() driver.get("https://www.linkedin.com/search/results/all/? keywords=director%20supply%20chain&origin=GLOBAL_SEARCH_HEADER&page=1")
您需要找到用户名和密码框并将它们输入。我发现使用css元素id最容易做到这一点。硒有一种find_element_by_id的方法。看看我做的这个小selenium自动登录项目: https://github.com/bnorquist/auto_login/blob/master/scripts/login.py#L7
find_element_by_id
这个代码正在工作
您需要找到用户名和密码框并将它们输入。我发现使用css元素id最容易做到这一点。硒有一种
find_element_by_id
的方法。看看我做的这个小selenium自动登录项目: https://github.com/bnorquist/auto_login/blob/master/scripts/login.py#L7相关问题 更多 >
编程相关推荐