I had a look at all the similar questions on SO but couldn't manage to solve my problem. Selenium does not seem to locate a button I am trying to click on to load more the page before scraping.
In the picture below is the button I am trying to click on to load more the page before doing some scraping (class name of button : btn btn-default)
What I have done: I used Selenium's webdriver. I tried waiting for at least 5 seconds for the page to load using sleep. And lastly using the click() function. I have inspired myself from this tutorial (section : Using Selenium)
urlpage = 'theurl'
My code is the following :
driver = webdriver.Firefox()
driver.get(urlpage)
driver.execute_script("window.scrollTo(0, document.body.scrollHeight);var lenOfPage=document.body.scrollHeight;return lenOfPage;")
time.sleep(5)
button = driver.find_element_by_class_name("btn btn-default")
button.click()
I would appreciate if someone had an idea of what I am doing wrong :)
obscures it do you know how this could be fixed ?
– colla Jun 07 '20 at 14:32