I want to go the next page by click on a link with a span tag inside, using selenium python but stack somewhere. please kindly need your help.
Main part code
driver.get('https://shoobs.com/find-events')
selector= '//*[@]/span[7]/a'
links = WebDriverWait(driver, timeout=160).until(lambda d: d.find_element(By.XPATH,selector))
links.click()
driver.quit()
Error
selenium.common.exceptions.ElementClickInterceptedException: Message: element click intercepted: Element <a rel="next" href="/events?page=2">...</a> is not clickable at point (865, 924). Other element would receive the click: <div >...</div>
(Session info: chrome=105.0.5195.102)
Once browser opens if I scroll down it works properly and routed to next page but if I don't scroll down and put as it is it gives the above mentioned error.
CodePudding user response:
The above mentioned error indicates that you have to execute JavaScript
driver.get('https://shoobs.com/find-events')
selector= '//*[@]/span[7]/a'
links = WebDriverWait(driver, timeout=160).until(lambda d: d.find_element(By.XPATH,selector))
driver.execute_script("arguments[0].click();", links)