droefs / HLISA

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

AttributeError: 'list' object has no attribute 'rect' #49

Closed Kolhax closed 9 months ago

Kolhax commented 9 months ago

Code:

from selenium.webdriver import Firefox
#from webdriver_manager.Firefox import ChromeDriverManager
from selenium.webdriver.common.by import By
from HLISA.hlisa_action_chains import HLISA_ActionChains

from selenium.webdriver.firefox.options import Options

options = Options()
options.set_preference('intl.accept_languages', 'en-US, en')

driver = Firefox(options=options)

human_like_actions = HLISA_ActionChains(driver)

driver.get("https://domain.com/")

RegisterButton = driver.find_elements(By.XPATH,"/html/body/div[1]/")

human_like_actions.click(RegisterButton)
human_like_actions.perform()

Error:

Traceback (most recent call last):
  File "E:\!DEV\Discord token gen\main.py", line 20, in <module>
    human_like_actions.perform()
  File "E:\!DEV\Discord token gen\env\Lib\site-packages\HLISA\hlisa_action_chains.py", line 100, in perform
    action()
  File "E:\!DEV\Discord token gen\env\Lib\site-packages\HLISA\hlisa_action_chains.py", line 28, in <lambda>
    self.chain.append(lambda: actions.click(element, addDelayAfter))
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\!DEV\Discord token gen\env\Lib\site-packages\HLISA\selenium_actions.py", line 66, in click
    self.move_to_element(element)
  File "E:\!DEV\Discord token gen\env\Lib\site-packages\HLISA\selenium_actions.py", line 83, in move_to_element
    y_relative = int(element.rect['y']) - get_current_scrolling_position(self.webdriver)["y"]
                     ^^^^^^^^^^^^
AttributeError: 'list' object has no attribute 'rect'
bkrumnow commented 9 months ago

driver.find_elements <-- You passed a list to the function instead of an element.