python beautifulsoup4 selenium ChromeDriverManager [Webpage crawling is not working until the end]


I’m trying to get the coin name list from the webpage.
I’ve tried with soup but didn’t work for some reasons.
and also tried to use the selenium as well.
🙁 but not working either.

What is the problem with that web site? (I’ve found that the javascript & DOM issue? but couldn’t understand clearly..)
could I get some help to get the all list from the web?
(I’ve use the Chrome driver manager to avoid some errors)

from selenium import webdriver
from import ChromeDriverManager
from bs4 import BeautifulSoup
from selenium.webdriver.common.keys import Keys
import time

options = webdriver.ChromeOptions()
options.add_experimental_option("excludeSwitches", ["enable-logging"])
driver = webdriver.Chrome(ChromeDriverManager().install(),options=options)

html = driver.get('')
html = driver.page_source

driver.execute_script("window.scrollTo(0, document.body.scrollHeight)")

soup = BeautifulSoup(html, 'html.parser')

status_today = soup.find_all('div',{'class':'sc-16r8icm-0 escjiH'},'href')

for x in status_today:

The results contains 10 lines only, there are 100 coin lists…

x.a[href]= /currencies/bitcoin/
x.a[href]= /currencies/ethereum/
x.a[href]= /currencies/binance-coin/
x.a[href]= /currencies/cardano/
x.a[href]= /currencies/tether/
x.a[href]= /currencies/xrp/
x.a[href]= /currencies/solana/
x.a[href]= /currencies/polkadot-new/
x.a[href]= /currencies/usd-coin/
x.a[href]= /currencies/dogecoin/


You need to scroll to each element and then you can extract the href out of the anchor tag.

Also make sure to use Explicit waits.

xpath that we are using is //tbody//tr with indexing.

Code :

driver = webdriver.Chrome(driver_path)
wait = WebDriverWait(driver, 30)


j = 1
while True:
        row  = wait.until(EC.visibility_of_element_located((By.XPATH, f"(//tbody//tr)[{j}]")))
        driver.execute_script("arguments[0].scrollIntoView(true);", row)
        href = row.find_element_by_xpath(".//descendant::div[@class='sc-16r8icm-0 escjiH']//a").get_attribute('href')
        j = j +1

Imports :

from import WebDriverWait
from import By
from import expected_conditions as EC

Output :

Answered By – cruisepandey

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published