I would like to have Selenium navigate thorught the items of a navbar of this page, then retrieve its contents and pass them to beatifulsoup.
My code works fine for the first page, after which I get the following error:
ElementClickInterceptedException: Message: element click intercepted: Element <a href="https://www.rollingstone.com/music/music-lists/500-greatest-songs-of-all-time-151127/smokey-robinson-and-the-miracles-shop-around-71184" style="color: rgb(211, 37, 49); padding: 4px 8px;">...</a> is not clickable at point (77, 73). Other element would receive the click: <div class="fc-dialog-overlay"></div>
Previous answers have not helped. Here is my code. I would truly appreciate any help.
webdriver.ChromeOptions()
options.add_argument('--ignore-certificate-errors')
options.add_argument('--incognito')
options.add_argument('--headless')
driver = webdriver.Chrome(options=options)
target_page = 'https://www.rollingstone.com/music/music-lists/500-greatest-songs-of-all-time-151127/'
driver.get(target_page)
header = driver.find_element_by_id('pmc-gallery-list-nav-bar-render')
items = header.find_elements_by_tag_name('a')
songs = []
for item in items:
driver.maximize_window()
time.sleep(5)
item.click()
page_source = driver.page_source
soup = BeautifulSoup(page_source)
song_all = soup.find_all('h2', {'class':'c-gallery-vertical-album__title'})
for song in song_all:
songs.append(strip_extra_chars(song.get_text()))
driver.quit()