Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ##### Code #####
- def create_account(self, proxy=None):
- chrome_options = webdriver.ChromeOptions()
- chrome_options.add_experimental_option("prefs", {"profile.managed_default_content_settings.images": 2})
- chrome_options.add_argument('--user-agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.80 Safari/537.36"')
- chrome_options.add_argument("--no-sandbox")
- chrome_options.add_argument("--disable-setuid-sandbox")
- chrome_options.add_argument("--remote-debugging-port=9222")
- chrome_options.add_argument("--disable-dev-shm-using")
- chrome_options.add_argument("--disable-extensions")
- chrome_options.add_argument("--disable-gpu")
- chrome_options.add_argument("start-maximized")
- chrome_options.add_argument("disable-infobars")
- chrome_options.add_argument("--headless")
- chrome_options.add_argument("user-data-dir=cookies")
- chrome_options.add_argument("--incognito")
- chrome_options.add_argument('window-size=1200x600')
- chrome_options.add_argument('--log-level=DEBUG')
- if proxy != None:
- chrome_options.add_argument('--proxy-server=%s' % proxy)
- driver = webdriver.Chrome(options=chrome_options, executable_path=os.path.abspath("chromedriver"))
- driver.get(self.url)
- wait = WebDriverWait(driver, 10)
- action_chains = ActionChains(driver)
- account_info = self.generate_information()
- email_field = wait.until(lambda driver: driver.find_element_by_name('emailOrPhone'))
- action_chains.move_to_element(email_field)
- email_field.send_keys(str(account_info["email"]))
- self.successful_print("E-Mail : {}".format(account_info["email"]))
- fullname_field = wait.until(lambda driver: driver.find_element_by_name('fullName'))
- action_chains.move_to_element(fullname_field)
- fullname_field.send_keys(account_info["full_name"])
- self.successful_print("Full Name : {}".format(account_info["full_name"]))
- username_field = wait.until(lambda driver: driver.find_element_by_name('username'))
- action_chains.move_to_element(username_field)
- username_field.send_keys(account_info["username"])
- self.successful_print("Username : {}".format(account_info["username"]))
- password_field = wait.until(lambda driver: driver.find_element_by_name('password'))
- action_chains.move_to_element(password_field)
- passW = account_info["password"]
- self.successful_print("Password : {}".format(passW))
- password_field.send_keys(str(passW))
- submit = driver.find_element_by_xpath('//*[@id="react-root"]/section/main/article/div[2]/div[1]/div/form/div[7]/div/button')
- action_chains.move_to_element(submit)
- submit.click()
- driver.quit()
- driver.close()
- ##### Traceback #####
- Traceback (most recent call last):
- File "main.py", line 310, in <module>
- account.create_config()
- File "main.py", line 293, in create_config
- self.create_account(proxy)
- File "main.py", line 229, in create_account
- driver = webdriver.Chrome(options=chrome_options, executable_path=os.path.abspath("chromedriver"))
- File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/chrome/webdriver.py", line 81, in __init__
- desired_capabilities=desired_capabilities)
- File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/remote/webdriver.py", line 157, in __init__
- self.start_session(capabilities, browser_profile)
- File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/remote/webdriver.py", line 252, in start_session
- response = self.execute(Command.NEW_SESSION, parameters)
- File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
- self.error_handler.check_response(response)
- File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
- raise exception_class(message, screen, stacktrace)
- selenium.common.exceptions.WebDriverException: Message: unknown error: unable to discover open pages
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement