|
1 | 1 | # Gmail Account Creation Automation Script - Version 1.1.0 |
2 | 2 | # Original script by Abdelhakim Khaouiti (khaouitiabdelhakim on GitHub) |
3 | | - |
| 3 | +# Account Creation Automation Script - Version 1.1.0 |
| 4 | +# Original script by Abdelhakim Khaouiti (khaouitiabdelhakim on GitHub) |
4 | 5 | from selenium import webdriver |
5 | 6 | from selenium.webdriver.common.by import By |
6 | 7 | from selenium.webdriver.support.ui import Select, WebDriverWait |
7 | 8 | from selenium.webdriver.support import expected_conditions as EC |
8 | | - |
9 | 9 | from selenium.webdriver.chrome.service import Service as ChromeService |
10 | 10 | from selenium.webdriver.chrome.options import Options as ChromeOptions |
| 11 | +import random |
| 12 | +import time |
| 13 | +from unidecode import unidecode |
11 | 14 |
|
12 | | -#chrome_options = ChromeOptions() |
13 | | -#chrome_options.add_argument("--disable-infobars") # Optional: Disable info bars |
| 15 | +# Chrome options |
| 16 | +chrome_options = ChromeOptions() |
| 17 | +chrome_options.add_argument("--disable-infobars") |
14 | 18 |
|
| 19 | +# WebDriver service |
15 | 20 | service = ChromeService('chromedriver.exe') |
16 | | -driver = webdriver.Chrome(service=service) #, options=chrome_options) |
17 | | - |
18 | | - |
19 | | -# your data |
20 | | -your_first_name = "Gamal" |
21 | | -your_last_name = "DoeLy" |
22 | | -your_username = "gamadoe1445pro" # [email protected] // make sure to be unique |
23 | | -your_birthday = "02 3 1999" #dd m yyyy exp : 24 11 2003 |
| 21 | +driver = webdriver.Chrome(options=chrome_options) |
| 22 | + |
| 23 | +french_first_names = [ |
| 24 | + "Amélie", "Antoine", "Aurélie", "Benoît", "Camille", "Charles", "Chloé", "Claire", "Clément", "Dominique", |
| 25 | + "Élodie", "Émilie", "Étienne", "Fabien", "François", "Gabriel", "Hélène", "Henri", "Isabelle", "Jules", |
| 26 | + "Juliette", "Laurent", "Léa", "Léon", "Louise", "Lucas", "Madeleine", "Marc", "Margaux", "Marie", |
| 27 | + "Mathieu", "Nathalie", "Nicolas", "Noémie", "Olivier", "Pascal", "Philippe", "Pierre", "Raphaël", "René", |
| 28 | + "Sophie", "Stéphane", "Suzanne", "Théo", "Thomas", "Valentin", "Valérie", "Victor", "Vincent", "Yves", |
| 29 | + "Zoé", "Adèle", "Adrien", "Alexandre", "Alice", "Alix", "Anatole", "André", "Angèle", "Anne", |
| 30 | + "Baptiste", "Basile", "Bernard", "Brigitte", "Céleste", "Céline", "Christophe", "Cyril", "Denis", "Diane", |
| 31 | + "Édouard", "Éléonore", "Émile", "Félix", "Florence", "Georges", "Gérard", "Guillaume", "Hugo", "Inès", |
| 32 | + "Jacques", "Jean", "Jeanne", "Joséphine", "Julien", "Laure", "Lucie", "Maëlle", "Marcel", "Martine", |
| 33 | + "Maxime", "Michel", "Nina", "Océane", "Paul", "Perrine", "Quentin", "Romain", "Solène", "Thérèse" |
| 34 | +] |
| 35 | + |
| 36 | +french_last_names = [ |
| 37 | + "Leroy", "Moreau", "Bernard", "Dubois", "Durand", "Lefebvre", "Mercier", "Dupont", "Fournier", "Lambert", |
| 38 | + "Fontaine", "Rousseau", "Vincent", "Muller", "Lefèvre", "Faure", "André", "Gauthier", "Garcia", "Perrin", |
| 39 | + "Robin", "Clement", "Morin", "Nicolas", "Henry", "Roussel", "Mathieu", "Garnier", "Chevalier", "François", |
| 40 | + "Legrand", "Gérard", "Boyer", "Gautier", "Roche", "Roy", "Noel", "Meyer", "Lucas", "Gomez", |
| 41 | + "Martinez", "Caron", "Da Silva", "Lemoine", "Philippe", "Bourgeois", "Pierre", "Renard", "Girard", "Brun", |
| 42 | + "Gaillard", "Barbier", "Arnaud", "Martins", "Rodriguez", "Picard", "Roger", "Schmitt", "Colin", "Vidal", |
| 43 | + "Dupuis", "Pires", "Renaud", "Renault", "Klein", "Coulon", "Grondin", "Leclerc", "Pires", "Marchand", |
| 44 | + "Dufour", "Blanchard", "Gillet", "Chevallier", "Fernandez", "David", "Bouquet", "Gilles", "Fischer", "Roy", |
| 45 | + "Besson", "Lemoine", "Delorme", "Carpentier", "Dumas", "Marin", "Gosselin", "Mallet", "Blondel", "Adam", |
| 46 | + "Durant", "Laporte", "Boutin", "Lacombe", "Navarro", "Langlois", "Deschamps", "Schneider", "Pasquier", "Renaud" |
| 47 | +] |
| 48 | + |
| 49 | +# Randomly select a first name and a last name |
| 50 | +your_first_name = random.choice(french_first_names) |
| 51 | +your_last_name = random.choice(french_last_names) |
| 52 | + |
| 53 | +# Generate a random number |
| 54 | +random_number = random.randint(1000, 9999) |
| 55 | + |
| 56 | +# Retirer les accents des prénoms et nom de famille |
| 57 | +your_first_name_normalized = unidecode(your_first_name).lower() |
| 58 | +your_last_name_normalized = unidecode(your_last_name).lower() |
| 59 | + |
| 60 | + |
| 61 | +your_username = f"{your_first_name_normalized}.{your_last_name_normalized}{random_number}" |
| 62 | + |
| 63 | + |
| 64 | +your_birthday = "02 3 1989" #dd m yyyy exp : 24 11 2003 |
24 | 65 | your_gender = "1" # 1:F 2:M 3:Not say 4:Custom |
25 | 66 | your_password = "x,nscldsj123...FDKZ" |
26 | 67 |
|
27 | | -try: |
28 | | - driver.get("https://accounts.google.com/signup/v2/createaccount?flowName=GlifWebSignIn&flowEntry=SignUp") |
29 | | - |
30 | | - first_name = driver.find_element(By.NAME, "firstName") |
31 | | - last_name = driver.find_element(By.NAME, "lastName") |
32 | | - |
33 | | - first_name.clear() |
34 | | - first_name.send_keys(your_first_name) |
35 | | - |
36 | | - last_name.clear() |
37 | | - last_name.send_keys(your_last_name) |
38 | | - |
39 | | - next_button = driver.find_element(By.CLASS_NAME, "VfPpkd-LgbsSe") |
40 | | - next_button.click() |
41 | | - |
42 | | - wait = WebDriverWait(driver, 20) |
43 | | - day = wait.until(EC.visibility_of_element_located((By.NAME, "day"))) |
44 | | - |
45 | | - birthday_elements = your_birthday.split() |
46 | | - |
47 | | - month_dropdown = Select(driver.find_element(By.ID, "month")) |
48 | | - month_dropdown.select_by_value(birthday_elements[1]) |
49 | | - |
50 | | - day_field = driver.find_element(By.ID, "day") |
51 | | - day_field.clear() |
52 | | - day_field.send_keys(birthday_elements[0]) |
53 | | - |
54 | | - year_field = driver.find_element(By.ID, "year") |
55 | | - year_field.clear() |
56 | | - year_field.send_keys(birthday_elements[2]) |
57 | | - |
58 | | - gender_dropdown = Select(driver.find_element(By.ID, "gender")) |
59 | | - gender_dropdown.select_by_value(your_gender) |
60 | | - |
61 | | - next_button = driver.find_element(By.CLASS_NAME, "VfPpkd-LgbsSe") |
62 | | - next_button.click() |
63 | | - |
64 | | - create_own_option = wait.until(EC.element_to_be_clickable((By.ID, "selectionc2"))) |
65 | | - create_own_option.click() |
66 | | - |
67 | | - create_own_email = wait.until(EC.element_to_be_clickable((By.NAME, "Username"))) |
68 | | - username_field = driver.find_element(By.NAME, "Username") |
69 | | - username_field.clear() |
70 | | - username_field.send_keys(your_username) |
71 | | - |
72 | | - next_button = driver.find_element(By.CLASS_NAME, "VfPpkd-LgbsSe") |
73 | | - next_button.click() |
74 | | - |
75 | | - password_field = wait.until(EC.visibility_of_element_located((By.NAME, "Passwd"))) |
76 | | - password_field.clear() |
77 | | - password_field.send_keys(your_password) |
78 | | - |
79 | | - password_confirmation_field = driver.find_element(By.NAME, "PasswdAgain") |
80 | | - password_confirmation_field.clear() |
81 | | - password_confirmation_field.send_keys(your_password) |
82 | | - |
83 | | - next_button = driver.find_element(By.CLASS_NAME, "VfPpkd-LgbsSe") |
84 | | - next_button.click() |
85 | | - |
86 | | - # Skip add phone number |
87 | | - skip_button_is_visible = wait.until(EC.visibility_of_element_located((By.CSS_SELECTOR, "button span.VfPpkd-vQzf8d"))) |
88 | | - skip_button = driver.find_element(By.CSS_SELECTOR, "button span.VfPpkd-vQzf8d") |
89 | | - skip_button.click() |
90 | | - |
91 | | - # Skip add recovery email |
92 | | - skip_button_is_visible = wait.until(EC.visibility_of_element_located((By.CSS_SELECTOR, "button span.VfPpkd-vQzf8d"))) |
93 | | - skip_button = driver.find_element(By.CSS_SELECTOR, "button span.VfPpkd-vQzf8d") |
94 | | - skip_button.click() |
95 | | - |
96 | | - next_button = wait.until(EC.visibility_of_element_located((By.CLASS_NAME, "VfPpkd-LgbsSe"))) |
97 | | - next_button.click() |
98 | | - |
99 | | - # Agree on Google's privacies |
100 | | - agree_button = wait.until(EC.visibility_of_element_located((By.CSS_SELECTOR, "button span.VfPpkd-vQzf8d"))) |
101 | | - agree_button.click() |
102 | | - |
103 | | - # Close the browser window at the end of your automation |
104 | | - driver.quit() |
105 | | - |
106 | | - print("Your Gmail successfully created:\n{\ngmail: " + your_username + "@gmail.com\npassword: " + your_password + "\n}") |
107 | | - |
108 | | - |
109 | | -except Exception as e: |
110 | | - # Close the browser window in case of failure |
111 | | - driver.quit() |
112 | | - print("Failed to create your Gmail, Sorry") |
113 | | - print(e) |
| 68 | +def fill_form(driver): |
| 69 | + try: |
| 70 | + driver.get("https://accounts.google.com/signup/v2/createaccount?flowName=GlifWebSignIn&flowEntry=SignUp") |
| 71 | + |
| 72 | + # Fill in name fields |
| 73 | + first_name = driver.find_element(By.NAME, "firstName") |
| 74 | + last_name = driver.find_element(By.NAME, "lastName") |
| 75 | + first_name.clear() |
| 76 | + first_name.send_keys(your_first_name) |
| 77 | + last_name.clear() |
| 78 | + last_name.send_keys(your_last_name) |
| 79 | + next_button = driver.find_element(By.CLASS_NAME, "VfPpkd-LgbsSe") |
| 80 | + next_button.click() |
| 81 | + |
| 82 | + # Wait for birthday fields to be visible |
| 83 | + wait = WebDriverWait(driver, 20) |
| 84 | + day = wait.until(EC.visibility_of_element_located((By.NAME, "day"))) |
| 85 | + |
| 86 | + # Fill in birthday |
| 87 | + birthday_elements = your_birthday.split() |
| 88 | + month_dropdown = Select(driver.find_element(By.ID, "month")) |
| 89 | + month_dropdown.select_by_value(birthday_elements[1]) |
| 90 | + day_field = driver.find_element(By.ID, "day") |
| 91 | + day_field.clear() |
| 92 | + day_field.send_keys(birthday_elements[0]) |
| 93 | + year_field = driver.find_element(By.ID, "year") |
| 94 | + year_field.clear() |
| 95 | + year_field.send_keys(birthday_elements[2]) |
| 96 | + |
| 97 | + # Select gender |
| 98 | + gender_dropdown = Select(driver.find_element(By.ID, "gender")) |
| 99 | + gender_dropdown.select_by_value(your_gender) |
| 100 | + next_button = driver.find_element(By.CLASS_NAME, "VfPpkd-LgbsSe") |
| 101 | + next_button.click() |
| 102 | + |
| 103 | + |
| 104 | + # Create custom email |
| 105 | + time.sleep(2) |
| 106 | + if driver.find_elements(By.ID, "selectionc4") : |
| 107 | + create_own_option = wait.until(EC.element_to_be_clickable((By.ID,"selectionc4") )) |
| 108 | + create_own_option.click() |
| 109 | + |
| 110 | + create_own_email = wait.until(EC.element_to_be_clickable((By.NAME, "Username"))) |
| 111 | + username_field = driver.find_element(By.NAME, "Username") |
| 112 | + username_field.clear() |
| 113 | + username_field.send_keys(your_username) |
| 114 | + next_button = driver.find_element(By.CLASS_NAME, "VfPpkd-LgbsSe") |
| 115 | + next_button.click() |
| 116 | + |
| 117 | + # Enter and confirm password |
| 118 | + password_field = wait.until(EC.visibility_of_element_located((By.NAME, "Passwd"))) |
| 119 | + password_field.clear() |
| 120 | + password_field.send_keys(your_password) |
| 121 | + # Locate the parent div element with the ID "confirm-passwd" |
| 122 | + confirm_passwd_div = driver.find_element(By.ID, "confirm-passwd") |
| 123 | + #Find the input field inside the parent div |
| 124 | + password_confirmation_field = confirm_passwd_div.find_element(By.NAME, "PasswdAgain") |
| 125 | + password_confirmation_field.clear() |
| 126 | + password_confirmation_field.send_keys(your_password) |
| 127 | + next_button = driver.find_element(By.CLASS_NAME, "VfPpkd-LgbsSe") |
| 128 | + next_button.click() |
| 129 | + |
| 130 | + # Skip phone number and recovery email steps |
| 131 | + skip_buttons = wait.until(EC.presence_of_all_elements_located((By.CSS_SELECTOR, "button span.VfPpkd-vQzf8d"))) |
| 132 | + for button in skip_buttons: |
| 133 | + button.click() |
| 134 | + |
| 135 | + # Agree to terms |
| 136 | + agree_button = wait.until(EC.visibility_of_element_located((By.CSS_SELECTOR, "button span.VfPpkd-vQzf8d"))) |
| 137 | + agree_button.click() |
| 138 | + |
| 139 | + print(f"Your Gmail successfully created:\n{{\ngmail: {your_username}@gmail.com\npassword: {your_password}\n}}") |
| 140 | + |
| 141 | + except Exception as e: |
| 142 | + print("Failed to create your Gmail, Sorry") |
| 143 | + print(e) |
| 144 | + finally: |
| 145 | + driver.quit() |
| 146 | + |
| 147 | +# Execute the function to fill out the form |
| 148 | +fill_form(driver) |
0 commit comments