Python - 使用登录的网页抓取

时间:2021-06-16 16:30:30

标签: python selenium web-scraping beautifulsoup

我正在尝试抓取以下网站上的数据 -

https://www.<>.org.in/

右上角有登录->客户端登录,然后提示输入凭据。

有人可以帮忙吗?我尝试使用 Firefox 的网络选项卡,但我无法取得任何进展。

1 个答案:

答案 0 :(得分:0)

如果您有一个正在运行的驱动程序实例,以下应该适合您:

driver.get("https://www.<>.org.in/#/home")
wait = WebDriverWait(driver, 10)
wait.until(EC.element_to_be_clickable((By.CSS_SELECTOR, "a[placement='bottom-left']"))).click()
wait.until(EC.element_to_be_clickable((By.LINK_TEXT, "Client Login"))).click()
wait.until(EC.element_to_be_clickable((By.NAME, "username"))).send_keys(" your username")
wait.until(EC.element_to_be_clickable((By.NAME, "password"))).send_keys(" your password")
wait.until(EC.element_to_be_clickable((By.XPATH, "//input[@name='password']/../following-sibling::div[1]/button"))).click()