I'm trying to click 'Show More' button on a web page. I wrote this code but get an error below the code.
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
#Open Chrome
driver=webdriver.Chrome(executable_path="C:/Users/chromedriver.exe")
web="https://www.expedia.com/Hotel-Search?adults=1&destination=Montreal%2C%20Quebec%2C%20Canada&endDate=2019-09-16&latLong=45.50195%2C-73.56714&localDateFormat=M%2Fd%2Fyyyy®ionId=178288&sort=recommended&startDate=2019-09-15&useRewards=true"
driver.get(web)
driver.maximize_window()
#parse html
html =driver.page_source
soup=BeautifulSoup(html,"html.parser")
time.sleep(5)
WebDriverWait(driver, 5)
#click show more
show_more=driver.find_element_by_link_text('Show More')
#Another element is covering the element you are to click.
driver.execute_script("arguments[0].click();", show_more)
Error:
NoSuchElementException: Message: no such element: Unable to locate element: {"method":"link text","selector":"Show More"}
At first, I didn't include the last line (execute_script...) but thought it would work if I include that line but still the same.
Any help would be appreciated.
An extra question is that is there any way to click 'Show More' button multiple times? because I noticed that I had to click multiple times to look up all the hotel listings.