I try to scrape product titles from https://www.ternbicycles.com/us/bikes#
I try to use xpath and css selector, but the find_elements() function only returns empty list. I didn't find framesets from this page and use execute_script to scrolled the window down to bottom... oh and I did set up wait time
But still no use....
Could some one help me out. Maybe could help me to try this url and give me some idea Thank you
URL='https://www.ternbicycles.com/us/bikes'
driver.implicitly_wait(10)
driver.get(URL)
driver.execute_script("window.scrollTo(0, document.body.scrollHeight);")
print(driver.title)
titles=driver.find_elements(By.CSS_SELECTOR,"//a[normalize-space()='Quick Haul P9 Performance']")
print(titles)
#result: Just a moment... []
############################################################# Update at 14:05 08/26/2022 Thank you guys for your reply,,,
i am using colab and i got TimeoutException: Message: Stacktrace... think should be a configuration problem? Do you have any solution?
Here is what i imported before i ran your codes
!apt-get update
!apt install chromium-chromedriver
!cp /usr/lib/chromium-browser/chromedriver /usr/bin
!pip install selenium
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.wait import WebDriverWait
#set up Chrome driver
options=webdriver.ChromeOptions()
options.add_argument('--headless')
options.add_argument('--no-sandbox')
options.add_argument('--disable-dev-shm-usage')
options.add_argument("window-size=1280,720")
#Define web driver as a Chrome driver
driver=webdriver.Chrome('chromedriver',options=options)
driver.implicitly_wait(10)