-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Catch "click not possible" #19
Comments
Yes, this should do it: from HLISA.errors import OutOfViewportException
from HLISA.hlisa_action_chains import HLISA_ActionChains
actions = HLISA_ActionChains(driver)
try:
actions.move_to_element(element).click().perform()
except OutOfViewportException:
print("catching click not possible, out of viewport")
This is interesting. Do I understand correctly that there is an element in the viewport, which you need to scroll in, and only after scrolling this element, the element you want to click on shows up? |
Thank you for your answer. This is interesting. Do I understand correctly that there is an element in the viewport, which you need to scroll in, and only after scrolling this element, the element you want to click on shows up? |
Due to time constraints I will for now not make a function that performs exactly the task you want to do. But I added the possibility to specify an element in the scroll_by(), which makes it possible to scroll human like in an element. You can use Example: driver.get("https://stackoverflow.com/questions/15182496/why-does-this-code-using-random-strings-print-hello-world?noredirect=1&lq=1")
time.sleep(5)
element_to_scroll_in = driver.find_element(By.XPATH, "/html/body/div[3]/div[2]/div/div[1]/div[3]/div[3]/div[5]/div/div[2]/div[1]/pre[1]")
actions.move_to_element_outside_viewport(element_to_scroll_in)
actions.scroll_by(0, 300, element=element_to_scroll_in)
actions.perform() |
Hi.
Is it possible to catch "click not possible, out of viewport" when using the move_to_element action?
Action move_to_element_outside_viewport does not work for me, because the element with scrolling is inside another webelement.
The text was updated successfully, but these errors were encountered: