I have to scrape all the event details from the AXS.com website as a part on my webscraping assignment. I have tried using chrome web driver with Python+Selenium.
I am able to get the value by using driver.find_element_by_class_name()
e.g. driver.find_element_by_class_name("headliner").text
.
But this get only the first item. I got stuck by while I tried iterating after using driver.find_elements(By.XPATH,"//div[@class='results-table results-table--events']")
.
from bs4 import BeautifulSoup
from selenium import webdriver
import time
driver = webdriver.Chrome('/home/.../chromedriver_linux64/chromedriver')
driver.get("https://www.axs.com/browse/music/alternative-punk")
driver.implicitly_wait(10)
allevent_details = driver.find_elements(By.XPATH,"//div[@class='results-table results-table--events']")
for i in allevent_details:
print(i.find_element_by_class_name("headliner").text)
Error
NoSuchElementException: no such element: Unable to locate element: {"method":"class name","selector":"headliner"}
(Session info: chrome=74.0.3729.169)
(Driver info: chromedriver=74.0.3729.6 (255758eccf3d244491b8a1317aa76e1ce10d57e9-refs/branch-heads/3729@{#29}),platform=Linux 4.15.0-50-generic x86_64)
Expected:
- Inner Wave
- BLOXX.... etc