SHARE
TWEET

Untitled

a guest Oct 10th, 2019 303 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ##### Code #####
  2.  
  3.  
  4.     def create_account(self, proxy=None):
  5.         chrome_options = webdriver.ChromeOptions()
  6.         chrome_options.add_experimental_option("prefs", {"profile.managed_default_content_settings.images": 2})
  7.         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"')
  8.         chrome_options.add_argument("--no-sandbox")
  9.         chrome_options.add_argument("--disable-setuid-sandbox")
  10.         chrome_options.add_argument("--remote-debugging-port=9222")
  11.         chrome_options.add_argument("--disable-dev-shm-using")
  12.         chrome_options.add_argument("--disable-extensions")
  13.         chrome_options.add_argument("--disable-gpu")
  14.         chrome_options.add_argument("start-maximized")
  15.         chrome_options.add_argument("disable-infobars")
  16.         chrome_options.add_argument("--headless")
  17.         chrome_options.add_argument("user-data-dir=cookies")
  18.         chrome_options.add_argument("--incognito")
  19.         chrome_options.add_argument('window-size=1200x600')
  20.         chrome_options.add_argument('--log-level=DEBUG')
  21.         if proxy != None:
  22.             chrome_options.add_argument('--proxy-server=%s' % proxy)
  23.         driver = webdriver.Chrome(options=chrome_options, executable_path=os.path.abspath("chromedriver"))
  24.         driver.get(self.url)
  25.         wait = WebDriverWait(driver, 10)
  26.         action_chains = ActionChains(driver)
  27.         account_info = self.generate_information()
  28.         email_field = wait.until(lambda driver: driver.find_element_by_name('emailOrPhone'))
  29.         action_chains.move_to_element(email_field)
  30.         email_field.send_keys(str(account_info["email"]))
  31.         self.successful_print("E-Mail : {}".format(account_info["email"]))
  32.         fullname_field = wait.until(lambda driver: driver.find_element_by_name('fullName'))
  33.         action_chains.move_to_element(fullname_field)
  34.         fullname_field.send_keys(account_info["full_name"])
  35.         self.successful_print("Full Name : {}".format(account_info["full_name"]))
  36.         username_field = wait.until(lambda driver: driver.find_element_by_name('username'))
  37.         action_chains.move_to_element(username_field)
  38.         username_field.send_keys(account_info["username"])
  39.         self.successful_print("Username : {}".format(account_info["username"]))
  40.         password_field = wait.until(lambda driver: driver.find_element_by_name('password'))
  41.         action_chains.move_to_element(password_field)
  42.         passW = account_info["password"]
  43.         self.successful_print("Password : {}".format(passW))
  44.         password_field.send_keys(str(passW))
  45.         submit = driver.find_element_by_xpath('//*[@id="react-root"]/section/main/article/div[2]/div[1]/div/form/div[7]/div/button')
  46.         action_chains.move_to_element(submit)
  47.         submit.click()
  48.         driver.quit()
  49.         driver.close()
  50.  
  51.  
  52.  
  53. ##### Traceback #####
  54.  
  55.  
  56. Traceback (most recent call last):
  57.   File "main.py", line 310, in <module>
  58.     account.create_config()
  59.   File "main.py", line 293, in create_config
  60.     self.create_account(proxy)
  61.   File "main.py", line 229, in create_account
  62.     driver = webdriver.Chrome(options=chrome_options, executable_path=os.path.abspath("chromedriver"))
  63.   File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/chrome/webdriver.py", line 81, in __init__
  64.     desired_capabilities=desired_capabilities)
  65.   File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/remote/webdriver.py", line 157, in __init__
  66.     self.start_session(capabilities, browser_profile)
  67.   File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/remote/webdriver.py", line 252, in start_session
  68.     response = self.execute(Command.NEW_SESSION, parameters)
  69.   File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
  70.     self.error_handler.check_response(response)
  71.   File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
  72.     raise exception_class(message, screen, stacktrace)
  73. selenium.common.exceptions.WebDriverException: Message: unknown error: unable to discover open pages
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top