I'm trying to extract the names of 1268 companies from the website of industrial fair which has uploaded the exhibitors list on this page.
Unfortunately selenium seems not to find the elements into the specific inner part of the webpage that contains companies' names and that has its own scrollbar.
Here's my code:
g = webdriver.Chrome()
g.get("https://www.ecomondo.com/elenco-espositori/espositori-ecomondo")
g.maximize_window()
time.sleep(2)
cookie = WebDriverWait(g,15).until(
EC.presence_of_element_located((By.XPATH, '//*[@id="c-p-bn"]'))
)
cookie.click()
time.sleep(5)
element = g.find_element_by_class_name('sc-1aq2rfp-0 sc-li856a-3 eqfJYB euBeDv')
ActionChains(g).move_to_element_with_offset(element, 0, 0).perform()
company_name = g.find_elements_by_xpath('//*[@id="__next"]/div[3]/div/div/div/div/div/a/div/div/span[1]')
print(company_name)
I also tried finding the element by xpath but the result is the same:
Message: no such element: Unable to locate element: {"method":"css selector","selector":".sc-1aq2rfp-0 sc-li856a-3 eqfJYB euBeDv"}
After find the element I should scroll the sidebar down to make all the 1268 companies' name visible and eventually extract them but these are other stories.
Any hints?