Open johny322 opened 2 years ago
Same here
Thank you for reporting this issue!
Unfortunately I do not have time to look into this issue now, I will try to do so in the coming days.
You can try to add the flag browser_resets_cursor_location=False
when you instantiate the HLISA_ActionChains
object:
HLISA_ActionChains(browser, browser_resets_cursor_location=False)
But I am afraid there might be a bug as the issue opened earlier today seems very similar.
Thank you.
HLISA_ActionChains(browser, browser_resets_cursor_location=False) It helped, but only when creating a new HLISA_ActionChains class instance for a new action
Unfortunately I am unable to reproduce the error. Some questions:
login_button
is further to the right or bottom of the page than the password_input
field? (Are the x and y coordinates of the login_button
larger than the x and y coordinates of the password_input
field?)It helped, but only when creating a new HLISA_ActionChains class instance for a new action
human_like_actions = HLISA_ActionChains(webdriver)
human_like_actions.move_to_element(login_button).click().perform()
a new page is loaded
password_input = browser.find_element(By.ID, 'password')
password = password
HLISA_ActionChains(webdriver, browser_resets_cursor_location=False).move_to_element(password_input)
.send_keys(password, password_input).perform()
but after clicking, url changes and next code causes an error: move target out of bounds.
(x, y) is out of bounds of viewport width...
. Those coordinates would help.Thank you!
Do I understand it correctly that after this modification your code is like this:
s strange, but now i have a new error
StaleElementReferenceException(not
MoveTargetOutOfBoundsException) when I don
t create a new class instance. I did not update the library.
Full error:
selenium.common.exceptions.StaleElementReferenceException: Message: stale element reference: element is not attached to the page document (Session info: chrome=101.0.4951.41)
Code with error StaleElementReferenceException:
human_like_actions = HLISA_ActionChains(webdriver)
human_like_actions.move_to_element(login_button).click().perform()
a new page is loaded
password_input = browser.find_element(By.ID, 'password')
password = password
human_like_actions.move_to_element(password_input) .send_keys(password, password_input).perform()
Code without error:
human_like_actions = HLISA_ActionChains(webdriver)
human_like_actions.move_to_element(login_button).click().perform()
a new page is loaded
password_input = browser.find_element(By.ID, 'password')
password = password
HLISA_ActionChains(webdriver, browser_resets_cursor_location=False).move_to_element(password_input) .send_keys(password, password_input).perform()
Thank you for the detailed information!
I think the stale StaleElementReferenceException happens because you do not instantiate a new HLISA_ActionChains and/or reset the human_like_actions. As a result, on the newly loaded page, Selenium tries to move to the login_button. As the login button is not on the new page, the StaleElementReferenceException is raised.
human_like_actions = HLISA_ActionChains(webdriver)
human_like_actions.move_to_element(login_button).click().perform() # this moves to the login element
a new page is loaded
password_input = browser.find_element(By.ID, 'password')
password = password
human_like_actions.move_to_element(password_input) .send_keys(password, password_input).perform() # this moves to the login_button, then moves to the password_input element, then send keys.
Solution:
human_like_actions = HLISA_ActionChains(webdriver)
human_like_actions.move_to_element(login_button).click().perform()
human_like_actions.reset_actions()
a new page is loaded
password_input = browser.find_element(By.ID, 'password')
password = password
human_like_actions.move_to_element(password_input) .send_keys(password, password_input).perform()
For the MoveTargetOutOfBoundsException, it might help if you directly add the flag to the HLISA_ActionChains:
human_like_actions = HLISA_ActionChains(webdriver, browser_resets_cursor_location=False)
human_like_actions.move_to_element(login_button).click().perform()
a new page is loaded
password_input = browser.find_element(By.ID, 'password')
password = password
human_like_actions.move_to_element(password_input) .send_keys(password, password_input).perform()
But it might still fail. In the coming days, I am going to try and reproduce the error you have and fix it. Besides, we are working on a more robust mechanism for mouse movements, which should resolve the issue you are experiencing. But that is not straightforward to implement, so it might take a bit longer.
The more robust mouse movement mechanism is in place, so I am closing this issue.
Hi droefs, first, thanks for this awesome contribution, I'm making some tests with this module and so far is looking good.
I just wanted to inform that I've been having this same troubles of move target out of bounds
in version 1.5.0,
First I didn't understand why in one machine was working right and in another not, and then when I compared versions I found that in version 1.4.1 is working perfect and in 1.5.0 the exact same code is having that problem.
My sceneario is including undetected chromedriver and rpyc also, in combination with HLISA, since I don't want to generate confusion please let me know what kind of detailed information I can give in order to help to solve the issue, for now I can just copy paste the terminal output, but then if you need pieces of code or pages I'm browsing just let me know.
Traceback (most recent call last):
File "C:\Users\gonns\AppData\Local\Programs\Python\Python39\lib\site-packages\rpyc\core\protocol.py", line 356, in _dispatch_request
res = self._HANDLERS[handler](self, *args)
File "C:\Users\gonns\AppData\Local\Programs\Python\Python39\lib\site-packages\rpyc\core\protocol.py", line 837, in _handle_call
return obj(*args, **dict(kwargs))
File "C:\Users\gonns\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 444, in execute
self.error_handler.check_response(response)
File "C:\Users\gonns\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 249, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.MoveTargetOutOfBoundsException: Message: move target out of bounds
(Session info: chrome=108.0.5359.99)
Stacktrace:
Backtrace:
(No symbol) [0x00FFF243]
(No symbol) [0x00F87FD1]
(No symbol) [0x00E7CF10]
(No symbol) [0x00EE3C80]
(No symbol) [0x00EC858C]
(No symbol) [0x00EDC9EB]
(No symbol) [0x00EC8386]
(No symbol) [0x00EA163C]
(No symbol) [0x00EA269D]
GetHandleVerifier [0x01299A22+2655074]
GetHandleVerifier [0x0128CA24+2601828]
GetHandleVerifier [0x010A8C0A+619850]
GetHandleVerifier [0x010A7830+614768]
(No symbol) [0x00F905FC]
(No symbol) [0x00F95968]
(No symbol) [0x00F95A55]
(No symbol) [0x00FA051B]
BaseThreadInitThunk [0x76AFFEF9+25]
RtlGetAppContainerNamedObjectPath [0x773E7BBE+286]
RtlGetAppContainerNamedObjectPath [0x773E7B8E+238]
Thank you for reporting this issue gonnsuarez!
It’s great that you have already narrowed down the problem to version 1.5.0 and provided this information. This issue might be a duplicate of #31 and #35, with the relevant part of the stack trace being hidden by rpyc. You can confirm this by:
a. using your current setup without undetected chromedriver b. using your current setup without undetected chromedriver and with chromium replaced by Firefox.
If a
still gives an error and b
does not, this issue will be solved as soon as #31 is solved.
I understand trying a
and b
is too much work, especially given that you cannot use Firefox as a solution for your current problem (assuming undetected chromedriver is incompatible with Firefox). Alternatively, you can continue using HLISA 1.4.1 until #31 is solved. HLISA 1.4.1 is equal to 1.5.0 except for an resolved uncommon issue in which the mouse pointer does not move to the correct location.
I am currently working on a solution for #31. Unfortunately the solution is harder to implement than expected, delaying the process.
Hi. I use your library and try to send keys to elements, but i faced problem. When driver changed url and i try use HLISA action chains i catch error selenium.common.exceptions.MoveTargetOutOfBoundsException: Message: move target out of bounds.
this works good human_like_actions: HLISA_ActionChains = browser.human_like_actions human_like_actions.move_to_element(login_button).click().perform()
but after clicking, url changes and next code causes an error: move target out of bounds. password_input = browser.find_element(By.ID, 'password') password = password HLISA_ActionChains(browser).move_to_element(password_input).send_keys(password, password_input).perform()
Please, help