1

I am trying to start a homemade bot, but get an error message every time. I installed all the requirements.

In this bot, there are two kinds of code. The first one creates an account without any use of proxy. And the second one creates serval accounts with proxy (only captcha key in zip file). All the requirements are done (proxy and captcha). So the first bot is working perfect, but the second one is the one that keeps messing with me.

The second code:

from time import sleep
import passgen
from selenium.webdriver.common.keys import Keys
import requests as r
from bs4 import BeautifulSoup as Bs
import sys
from requests import Session

redirect_domain = 'https://google.com'

# splitting proxies and saving to proxy_phrases file
with open('proxies.txt', 'r') as reader:
    proxies_to_separate = reader.read().strip().split('\n')
    for proxy in proxies_to_separate:
        proxy = proxy.split(':')
        PROXY_IP = proxy[0]
        PROXY_PORT = proxy[1]
        PROXY_IP_and_PORT = PROXY_IP + ":" + PROXY_PORT
        PROXY_USER = proxy[2]
        PROXY_PASS = proxy[3]
        proxy_phrase = "http://" + PROXY_USER + ":" + PROXY_PASS + "@" + PROXY_IP_and_PORT
        file = open('proxy_phrases.txt', 'a')
        file.write(f'{proxy_phrase}\n')
        file.close()

# main function of registering the account and verifying through email api
def signup(user):
    session = Session()
    session.proxies['http'] = str(proxy_phrase)
    ext_ip = session.get('http://checkip.dyndns.org')
    current_ip = ext_ip.text
    print(current_ip)
    email = r.get('https://www.1secmail.com/api/v1/?action=genRandomMailbox&count=1').json()[0]
    password = passgen.passgen()
    options = webdriver.ChromeOptions()
    options.add_experimental_option("excludeSwitches", ["enable-automation", 'enable-logging'])
    options.add_experimental_option('useAutomationExtension', False)
    options.add_argument("--lang=en")
    options.add_argument("user-agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.190 Safari/537.36")
    options.add_extension('anticaptcha.zip')
    browser = webdriver.Chrome(executable_path="chromedriver.exe", options=options)
    browser.minimize_window()
    browser.get('chrome://settings/clearBrowserData')
    browser.find_element_by_xpath('//settings-ui').send_keys(Keys.ENTER)
    browser.delete_all_cookies()
    browser.get('https://www.reddit.com/register/')
    browser.find_element_by_id('regEmail').send_keys(email)
    browser.find_element_by_id('regEmail').send_keys(Keys.ENTER)
    browser.find_element_by_id('regUsername').send_keys(user)
    browser.find_element_by_id('regPassword').send_keys(password)
    sleep(5)
    while True:
        try:
            status = browser.find_element_by_class_name('status')
            if status.get_attribute("innerHTML") == "Solved":
                break
        except:
            browser.quit()
            return False
    sleep(2)
    browser.find_element_by_id('regPassword').send_keys(Keys.ENTER)
    sleep(3)
    login, domain = email.split('@')
    id_msg = ''
    while True:
        res = r.get(f'https://www.1secmail.com/api/v1/?action=getMessages&login={login}&domain={domain}').json()
        if len(res) > 0:
            id_msg = res[0]['id']
            break
        else:
            sleep(2)
    res = r.get(f'https://www.1secmail.com/api/v1/?action=readMessage&login={login}&domain={domain}&id={id_msg}').json()
    soup = Bs(res['body'], features='lxml')
    link = soup.find('td', {'class': 'btn-14'}).find('a')['href']
    browser.get(link)
    sleep(5)

    sleep(5)
    session.close()
    browser.quit()
    file = open('accounts.txt', 'a')
    file.write(f'{email}:{user}:{password}\n')
    file.close()
    return True


# unpacking data files to zip together
file = open('usernames.txt', 'r')
usernames = file.read().splitlines()
file.close()

file = open('proxy_phrases.txt', 'r')
phrases = file.read().splitlines()
file.close()

# defining the dictionary
creds = {'usernames': [], 'proxy_phrases': []}

# iterating over user names and proxy phrases to register the accounts
for user, phrase in creds.items():
    with open(f"{user}.txt") as fp:
        creds.update({user: fp.read().splitlines()})
        creation_creds = list(zip(creds['usernames'], creds['proxy_phrases']))
    for one in creation_creds:
        getting_proxy = one[1]
        register_user = one[0]

        # session = Session()
        # session.proxies['https'] = str(getting_proxy)
        # response = session.get("https://reddit.com")
        # print("URL Response: ", response)

        signup(register_user)
        print("Successfully Registered ", register_user)
        sleep(800)

And this is what I get when I try to run the bot:

Creator-Proxy.py:42: DeprecationWarning: executable_path has been deprecated, please pass in a Service object
  browser = webdriver.Chrome(executable_path="chromedriver.exe", options=options)
Creator-Proxy.py:45: DeprecationWarning: find_element_by_* commands are deprecated. Please use find_element() instead
  browser.find_element_by_xpath('//settings-ui').send_keys(Keys.ENTER)
Traceback (most recent call last):
  File "Creator-Proxy.py", line 114, in <module>
    signup(register_user)
  File "Creator-Proxy.py", line 45, in signup
    browser.find_element_by_xpath('//settings-ui').send_keys(Keys.ENTER)
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python38\lib\site-packages\selenium\webdriver\remote\webelement.py", line 539, in send_keys
    self._execute(Command.SEND_KEYS_TO_ELEMENT,
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python38\lib\site-packages\selenium\webdriver\remote\webelement.py", line 693, in _execute
    return self._parent.execute(command, params)
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python38\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 418, in execute
    self.error_handler.check_response(response)
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python38\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 243, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.ElementNotInteractableException: Message: element not interactable
  (Session info: chrome=96.0.4664.45)
Stacktrace:
Backtrace:
        Ordinal0 [0x002E6903+2517251]
        Ordinal0 [0x0027F8E1+2095329]
        Ordinal0 [0x00182710+1058576]
        Ordinal0 [0x001A8993+1214867]
        Ordinal0 [0x001A80DF+1212639]
        Ordinal0 [0x001C64D3+1336531]
        Ordinal0 [0x001A3A36+1194550]
        Ordinal0 [0x001C65BA+1336762]
        Ordinal0 [0x001D5BBF+1399743]
        Ordinal0 [0x001C639B+1336219]
        Ordinal0 [0x001A27A7+1189799]
        Ordinal0 [0x001A3609+1193481]
        GetHandleVerifier [0x00475904+1577972]
        GetHandleVerifier [0x00520B97+2279047]
        GetHandleVerifier [0x00376D09+534521]
        GetHandleVerifier [0x00375DB9+530601]
        Ordinal0 [0x00284FF9+2117625]
        Ordinal0 [0x002898A8+2136232]
        Ordinal0 [0x002899E2+2136546]
        Ordinal0 [0x00293541+2176321]
        BaseThreadInitThunk [0x7567FA29+25]
        RtlGetAppContainerNamedObjectPath [0x77757A9E+286]
        RtlGetAppContainerNamedObjectPath [0x77757A6E+238]
        (No symbol) [0x00000000]

So please can someone tell me how to solve this error?

Ethan
  • 876
  • 8
  • 18
  • 34
Alex Joel
  • 11
  • 2

0 Answers0