· 4 years ago · Dec 01, 2020, 11:40 PM
1from selenium import webdriver
2from faker import Factory
3import time
4import unidecode
5import random
6
7fake = Factory.create('pl_PL')
8
9option = webdriver.ChromeOptions()
10option.add_argument("-incognito")
11#option.add_argument("--headless")
12#option.add_argument("disable-gpu")
13
14orgs = [
15 'Młodzi dla Wolności',
16 'Młodzież Wszechpolska',
17 'Armia Boga',
18 'Katolickie Stowarzyszenie Lekarzy Polskich',
19 'Papieska Akademia Życia',
20 'Polska Federacja Ruchów Obrony Życia',
21 '40 Dni dla Życia',
22 'Fundacja Pro',
23 'Duchowa adopcja',
24 'Marsz dla Życia i Rodziny',
25 'Strona Życia'
26]
27
28while True:
29 # co 10 wpisow uruchamia od nowa bo inaczej google sie robi podejrzliwy
30 browser = webdriver.Chrome(executable_path='chromedriver', options=option)
31 for i in range(10):
32 browser.get('https://docs.google.com/forms/d/1hUxLMJxDSmVDVD1rP3dJ3jSaUKPKh2Du4PnGLvMd5_Q')
33
34 textboxes = browser.find_elements_by_class_name("quantumWizTextinputPaperinputInput")
35 radiobuttons = browser.find_elements_by_class_name("docssharedWizToggleLabeledLabelWrapper")
36 checkboxes = browser.find_elements_by_class_name("quantumWizTogglePapercheckboxInnerBox")
37 submitbutton = browser.find_elements_by_class_name("appsMaterialWizButtonPaperbuttonEl")
38
39 p = browser.current_window_handle
40
41 radiobuttons[0].click()
42 fn = fake.first_name()
43 ln = fake.last_name()
44 fnu = unidecode.unidecode(fn).strip()
45 lnu = unidecode.unidecode(ln).strip()
46 textboxes[0].send_keys(fn)
47 textboxes[1].send_keys(ln)
48 textboxes[2].send_keys(fake.phone_number())
49 textboxes[3].send_keys(fnu.lower() + '.' + lnu.lower() + '@gmail.com')
50 textboxes[4].send_keys('https://facebook.com/' + fnu.lower() + '.' + lnu.lower())
51
52 if random.randint(0,1) == 0:
53 org = fake.word().capitalize()
54 else:
55 org = orgs[random.randint(0, len(orgs) - 1)]
56
57 textboxes[5].send_keys(org)
58 submitbutton[1].click()
59 time.sleep(0.4)
60 browser.close()
61