Helios-Archives / Twitch-Account-Creator

A selenium based bot to create accounts without the need for paid capcha solves.
MIT License
71 stars 10 forks source link

Unable to locate element #2

Closed Allesanddro closed 2 years ago

Allesanddro commented 2 years ago

Traceback (most recent call last): File "D:\projects\Twitch-Account-Toolbox\Modules\TAC.py", line 65, in <module> select = Select(driver.find_element(By.XPATH, '/html/body/div[3]/div/div/div/div/div/div[1]/div/div/div[3]/form/div/div[3]/div/div[2]/div[1]/select')) File "C:\Users\Sandro\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 1251, in find_element return self.execute(Command.FIND_ELEMENT, { File "C:\Users\Sandro\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 430, in execute self.error_handler.check_response(response) File "C:\Users\Sandro\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 247, in check_response raise exception_class(message, screen, stacktrace) selenium.common.exceptions.NoSuchElementException: Message: Unable to locate element: /html/body/div[3]/div/div/div/div/div/div[1]/div/div/div[3]/form/div/div[3]/div/div[2]/div[1]/select Stacktrace: WebDriverError@chrome://remote/content/shared/webdriver/Errors.jsm:188:5 NoSuchElementError@chrome://remote/content/shared/webdriver/Errors.jsm:400:5 element.find/</<@chrome://remote/content/marionette/element.js:292:16

when running the project I encounter this.

Br3n0k commented 2 years ago

here too

Helios-fr commented 2 years ago

This problem is caused because twitch actively changes the websites html to prevent programs like this from reliably working

Here is some simple steps to fix it.

  1. Identify what piece of code is broken.

  2. With the Firefox window open right click the element and inspect then copy xpath

  3. Replace the xpath in the code with the new xpath

  4. Rerun and repeat until you fix all the issues shouldn't take long

  5. Create a pull request with the updated xpath's if you want to this isn't necessary

After the xpath is replaced it should work for a solid 2 weeks unless you get unlucky with when they decide to change it.

Sorry for taking so long to respond I've been busy