-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
41 lines (28 loc) · 1.05 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
from selenium import webdriver
from selenium.webdriver.common.by import By
import time
import random
import string
driver = webdriver.Chrome()
num_submissions = 10
driver.get("http://www.midwilinc.com/web/index.php/contact")
time.sleep(2)
for i in range(num_submissions):
name = ''.join(random.choices(string.ascii_letters, k=10))
email = ''.join(random.choices(string.ascii_lowercase, k=5)) + "@example.com"
name_input = driver.find_element(By.ID, "name")
email_input = driver.find_element(By.ID, "email")
subject_input = driver.find_element(By.ID, "subject")
message_input = driver.find_element(By.ID, "message")
name_input.clear()
name_input.send_keys(name)
email_input.clear()
email_input.send_keys(email)
subject_input.clear()
subject_input.send_keys("Example Subject")
message_input.clear()
message_input.send_keys("Example message.")
submit_button = driver.find_element(By.ID, "sp_qc_submit")
submit_button.click()
time.sleep(2)
driver.quit()