I'm trying to parse the following url, "https://projects.worldbank.org/en/projects-operations/document-detail/P179109?type=projects", using selenium in python, to do the following: 1- Go to URL 2- Wait for page to either Load table of documents Load element "No data available." such in this example "https://projects.worldbank.org/en/projects-operations/document-detail/P179227?type=projects"
3- Parse the content of table of documents
I tried the multiple codes, though this is the final:
from selenium.webdriver.chrome.service import Service
from selenium import webdriver
from selenium.webdriver.common.by import By
import pandas as pd
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
urls = ['https://projects.worldbank.org/en/projects-operations/document-detail/P179109?type=projects','https://projects.worldbank.org/en/projects-operations/document-detail/P179278?type=projects'
driver = webdriver.Chrome()
wait = WebDriverWait(driver, 10)
l1=[]
for url in urls:
driver.get(url)
wait.until(EC.visibility_of_any_elements_located((By.XPATH,"//tr[@_ngcontent-c2=""]/td[@_ngcontent-c2=""]"),(By.CSS_SELECTOR("div.procurement_notices[_ngcontent-c2=""]"))))
# driver.find_element(By.TAG_NAME, 'tbody')
l1.append(driver.find_element(By.XPATH, '//tr[@_ngcontent-c2=""]/td[@_ngcontent-c2=""]').text)