Skip to content

Instantly share code, notes, and snippets.

@fergalmoran
Last active July 20, 2022 15:32
Show Gist options
  • Save fergalmoran/4f818fa340f17c1b3417b8ce135c6837 to your computer and use it in GitHub Desktop.
Save fergalmoran/4f818fa340f17c1b3417b8ce135c6837 to your computer and use it in GitHub Desktop.
Get prices from page
from selenium import webdriver
import time
from bs4 import BeautifulSoup
options = webdriver.ChromeOptions()
options.add_argument('--incognito')
options.add_argument('--headless')
driver = webdriver.Chrome(options=options)
driver.get('https://newthink.lenovo.com.cn/deviceGuarantee.html?selname=SA14632514')
time.sleep(10)
h = driver.page_source
soup = BeautifulSoup(h, 'html.parser')
dates = soup.find_all("p", {"class": "pc-dates"})
for date in dates:
print(date.text)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment