I need to click on a button using selenium in python. This is what I have:
read_more_buttons = responses[0].find_elements_by_class_name("read-more")
if len(read_more_buttons) > 0:
read_more_buttons[0].click()
It works fine most of the time but sometimes there's an overlay on the bottom of the page, which can not be dismissed. Therefore I'd get this error:
[element] is not clickable at point (665.7333145141602,883.4666748046875) because another element <div class="raq-module js-raq-module"> obscures it
I tried to scroll down the page with this code right before calling click()
:
driver.execute_script("window.scrollTo(0, " + str(read_more_buttons[0].location["y"] + 120) + ")")
However, I'm still receiving the same error. It seems like by calling .click()
the element is scrolled to the very bottom of the page, which is right under the overlay. How can I move up the page and then click?