Amazon-Hate-it-But-Need-it / Amazon-AtoZ-VET-Flex-Bot

Amazon AtoZ VET-Flex Bot for warehouse shifts.
MIT License
4 stars 1 forks source link

Xpath error? #2

Open ImRyzer opened 1 week ago

ImRyzer commented 1 week ago

was trying my best to fix this error but cant tell if its a timing issue or the change in xpath, im a newbie so bear with me. I had to add a few things to the code since itd crash due to pages not loading enough but now im getting this even if i add a little delay time for page to fully load, which worked succesfully and was even using it a couple hours ago but now im getting this error. I thought to myself maybe the xpath changed but im not sure, i like to believe it did since i couldnt find the original xpath.   Cookies saved successfully at cookies.json. Traceback (most recent call last): File "C:\Users\Admin\Downloads\AtoZ-Bot - test.py", line 184, in main()


  File "C:\Users\Admin\Downloads\AtoZ-Bot - test.py", line 177, in main
    browser.back_home()
    ~~~~~~~~~~~~~~~~~^^
  File "C:\Users\Admin\Downloads\AtoZ-Bot - test.py", line 107, in back_home
    link = self.driver.find_element(By.XPATH, "//ul[contains(@class, 'navbar-left')]/li[@class='active']/a")
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python313\Lib\site-packages\selenium\webdriver\remote\webdriver.py", line 766, in find_element
    return self.execute(Command.FIND_ELEMENT, {"using": by, "value": value})["value"]
           ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python313\Lib\site-packages\selenium\webdriver\remote\webdriver.py", line 380, in execute
    self.error_handler.check_response(response)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python313\Lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 229, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":"//ul[contains(@class, 'navbar-left')]/li[@class='active']/a"}
  (Session info: chrome=131.0.6778.70); For documentation on this error, please visit: https://www.selenium.dev/documentation/webdriver/troubleshooting/errors#no-such-element-exception
Stacktrace:
        GetHandleVerifier [0x00B25093+25075]
        (No symbol) [0x00AAE124]
        (No symbol) [0x0098BE63]
        (No symbol) [0x009CFD06]
        (No symbol) [0x009CFF4B]
        (No symbol) [0x00A0D8C2]
        (No symbol) [0x009F1EC4]
        (No symbol) [0x00A0B48E]
        (No symbol) [0x009F1C16]
        (No symbol) [0x009C3F3C]
        (No symbol) [0x009C4ECD]
        GetHandleVerifier [0x00E12523+3094147]
        GetHandleVerifier [0x00E25754+3172532]
        GetHandleVerifier [0x00E1DF32+3141778]
        GetHandleVerifier [0x00BC2100+668256]
        (No symbol) [0x00AB6C4D]
        (No symbol) [0x00AB3DF8]
        (No symbol) [0x00AB3F95]
        (No symbol) [0x00AA6C80]
        BaseThreadInitThunk [0x764AFCC9+25]
        RtlGetAppContainerNamedObjectPath [0x77DF809E+286]
        RtlGetAppContainerNamedObjectPath [0x77DF806E+238]
Amazon-Hate-it-But-Need-it commented 5 days ago

The issue was with line 123. I think amazon updated the website and the xpath for that element was changed. I updated the code to fix that issue along with issues due to time delays being too short. Let me know if the program is working without issues again @ImRyzer

ImRyzer commented 5 days ago

Great. awesome, I see that now, thanks for confirming my suspicions about the whole xpaths, spent awhile trying to fix it and turns out i was close to figuring it out lmao. But thanks again for taking your time out of your day to fix this issue, its working now, its been a massive help in getting shifts, shit is like near impossible to get on my own.