I have a page where I must login to get the page I would like to scrape using BeautifulSoup. My code currently looks like
import requests
from bs4 import BeautifulSoup
from selenium import webdriver
driver = webdriver.Firefox();
//loginpage is the page where I have to login. It is just used as a placeholder for this question
driver.get("loginpage");
driver.find_element_by_id("username").send_keys("username");
driver.find_element_by_id("password").send_keys("password");
driver.find_element_by_xpath("//button[@onclick=\"return validateFields();\"]").click();
//contentpage is where I get the content to scrape from. It is also just used as a placeholder for this question.
driver.get("contentpage");
html = driver.page_source;
soup = BeautifulSoup(html, features="lxml");
status = soup.find_all("span");
for status in status:
print(status);
But I think that the HTML is the wrong page because BeautifulSoup is returning NoneType when I can look in the browser and see that it should be there.