droefs / HLISA

A reimplementation of the Selenium API, emulating human interactions
https://pypi.org/project/HLISA/
GNU General Public License v3.0
73 stars 8 forks source link

HLISA.errors.HLISAException: The element could not be moved to. This is likely an error in HLISA, please raise an issue if it happens #22

Open k3fjeee opened 2 years ago

k3fjeee commented 2 years ago

Traceback (most recent call last): File "C:\Users\xyz\Desktop\coinmarket\cm.py", line 72, in actions.move_to_element(slider).perform() File "C:\Users\xyz\AppData\Local\Programs\Python\Python39\lib\site-packages\HLISA\hlisa_action_chains.py", line 101, in perform action() File "C:\Users\xyz\AppData\Local\Programs\Python\Python39\lib\site-packages\HLISA\hlisa_action_chains.py", line 83, in self.chain.append(lambda: actions.move_to_element(element, addDelayAfter)) File "C:\Users\xyz\AppData\Local\Programs\Python\Python39\lib\site-packages\HLISA\selenium_actions.py", line 80, in move_to_element raise HLISAException(error_msg) HLISA.errors.HLISAException: The element could not be moved to. This is likely an error in HLISA, please raise an issue if it happens

this error does not occur if I use selenium

slider = wait.until(EC.element_to_be_clickable((By.CLASS_NAME, 'css-1w5k7wg'))) time.sleep(1.2) actions.move_to_element(slider).pause(0.001).click_and_hold().move_by_offset(pix, 0).pause(0.001).move_by_offset(pix, 0).pause(0.01).move_by_offset(pix, 0).pause(0.001).move_by_offset(pix, 0).pause(0.001).release().perform()

bkrumnow commented 2 years ago

Hey, thanks for opening this issue. We would like to investigate the issue further. Could you provide us with the site's URL? Also, the selector used for slider and the value for pix could help.

Side note: I don't think you need timeouts, as HLISA has timeouts integrated. The timeouts are non-static and simulate human behaviour. So, your code could be reduced to:

actions.move_to_element(slider)
.click_and_hold()
.move_by_offset(pix, 0)
.release()
.perform()