I am trying to extract information from this page I want to get the names from the leftmost column. But any class name or selector or xpath I try, it returns an empty list. This is my code with a sample class name but others I tried also did not work. Please help select the right class name or selector. Thank you. My code:
import selenium
from selenium.webdriver.chrome import options
from selenium.webdriver.common.by import By
chrome_options = options.Options()
chrome_options.add_experimental_option("detach", True)
get_page = selenium.webdriver.Chrome(options = chrome_options)
get_page.get(r"https://app.folk.app/shared/US-VCs-oc71Oi94yB9vwbfh1XWIQPHTAGQE7FQ1?_gl=1*i6fxi5*_gcl_au*MjAxNDc5NDg2MC4xNzQzOTk2NzMy*_ga*MTczMTg1ODA3OS4xNzQzOTk2NzI5*_ga_WRYT325C9X*MTc0NDA0NDYyMi4yLjAuMTc0NDA0NDYyMy41OS4wLjY3MzkyNTk0MA..*_fplc*djJ1clZwbjFnR1RBUU9EQTkyTU9DaFQlMkZ4SUZhdG9ENHR3QUE0cFFTQjFaU21JQkJ6SFNxYktTbThSVyUyQjFJVEdKWUZVbEMwNGplN1paMG1mcTlXZnhqVUJNQ1ZxQnY4RVZaSVl3enJya2VxQjZZU0ZVdUs3ZFdxOGZOOFJTZyUzRCUzRA..")
list_of_investors = get_page.find_elements(By.CLASS_NAME, "c-jMIjwW-drVgRi")
for l in list_of_investors:
print (l.text)
The page content is heavily reliant on JavaScript rendering. Therefore, it is essential to use WebDriverWait
to ensure that the required elements are fully loaded before attempting to interact with them.
Additionally, the class name previously used appears to be incorrect, as no content is associated with it. Upon inspection, I identified the following class names related to the investor names:
c-jMIjwW c-jxvbnT c-jMIjwW-drVgRi-variant-textMedium c-jMIjwW-iepcqn-truncate-true
.
Kindly find below the corrected and complete code, where I have used the class name "c-jMIjwW-drVgRi-variant-textMedium":
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
chrome_options = Options()
chrome_options.add_experimental_option("detach", True)
driver = webdriver.Chrome(options=chrome_options)
driver.get("https://app.folk.app/shared/US-VCs-oc71Oi94yB9vwbfh1XWIQPHTAGQE7FQ1")
try:
# Wait for the names to load fully.
WebDriverWait(driver, 20).until(
EC.presence_of_all_elements_located((By.CLASS_NAME, "c-jMIjwW-drVgRi-variant-textMedium"))
)
list_of_investors = driver.find_elements(By.CLASS_NAME, "c-jMIjwW-drVgRi-variant-textMedium")
for investor in list_of_investors:
print(investor.text)
except Exception as e:
print("Error:", e)