Abid Rasheed
Abid Rasheed

Reputation: 81

Specific scraping data not in source code

I am trying to scrape a specific website, slader, and get the image in a specific div, solution-content. I am using requests and beautiful soup, but the problem is that the source code does not have the solutions. Is there a way to get that image?

URL for your reference: slader.com

Upvotes: 1

Views: 47

Answers (1)

Vova
Vova

Reputation: 3541

Try this:

from bs4 import BeautifulSoup

from selenium import webdriver
from selenium.webdriver.chrome.options import Options

option = Options()
option.add_argument('--headless')
url = 'https://www.slader.com/textbook/9780321696724-chemistry-the-central-science-12th-edition/694/exercises/1a/'
driver = webdriver.Chrome(options=option)
driver.get(url)
bs = BeautifulSoup(driver.page_source, 'html.parser')
print(bs.find_all('div', {'class': 'solution-content'}))
driver.quit()

Upvotes: 2

Related Questions