Spaces:
Paused
Paused
prabinpanta0
commited on
Commit
•
9096cff
1
Parent(s):
58f3be2
updated status section
Browse files- .gitpod.yml +11 -0
- __pycache__/form_filler.cpython-312.pyc +0 -0
- form_filler.py +6 -3
.gitpod.yml
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# This configuration file was automatically generated by Gitpod.
|
2 |
+
# Please adjust to your needs (see https://www.gitpod.io/docs/introduction/learn-gitpod/gitpod-yaml)
|
3 |
+
# and commit this file to your remote git repository to share the goodness with others.
|
4 |
+
|
5 |
+
# Learn more from ready-to-use templates: https://www.gitpod.io/docs/introduction/getting-started/quickstart
|
6 |
+
|
7 |
+
tasks:
|
8 |
+
- init: pip install -r requirements.txt
|
9 |
+
command: python app.py
|
10 |
+
|
11 |
+
|
__pycache__/form_filler.cpython-312.pyc
ADDED
Binary file (6.88 kB). View file
|
|
form_filler.py
CHANGED
@@ -47,12 +47,13 @@ class FormFiller:
|
|
47 |
radio_buttons = driver.find_elements(By.CSS_SELECTOR, 'div[role="radiogroup"]')
|
48 |
for radio_group in radio_buttons:
|
49 |
options = radio_group.find_elements(By.CSS_SELECTOR, 'div[role="radio"]')
|
|
|
50 |
random.choice(options).click()
|
51 |
|
52 |
# Handling checkboxes
|
53 |
checkboxes = driver.find_elements(By.CSS_SELECTOR, 'div[role="checkbox"]')
|
54 |
for checkbox in checkboxes:
|
55 |
-
if random.
|
56 |
checkbox.click()
|
57 |
|
58 |
# Handling multiple choice grids
|
@@ -61,6 +62,8 @@ class FormFiller:
|
|
61 |
rows = grid.find_elements(By.CSS_SELECTOR, 'div[role="row"]')
|
62 |
for row in rows:
|
63 |
options = row.find_elements(By.CSS_SELECTOR, 'div[role="radio"]')
|
|
|
|
|
64 |
random.choice(options).click()
|
65 |
|
66 |
# Submit the form
|
@@ -77,7 +80,7 @@ class FormFiller:
|
|
77 |
)
|
78 |
|
79 |
# Wait and reload the form
|
80 |
-
time.sleep(
|
81 |
driver.get(url)
|
82 |
|
83 |
except Exception as e:
|
@@ -125,4 +128,4 @@ class FormFiller:
|
|
125 |
for i in range(remaining_iterations):
|
126 |
futures.append(executor.submit(self.fill_form, url, 1, update_callback, i + 1))
|
127 |
for future in futures:
|
128 |
-
future.result()
|
|
|
47 |
radio_buttons = driver.find_elements(By.CSS_SELECTOR, 'div[role="radiogroup"]')
|
48 |
for radio_group in radio_buttons:
|
49 |
options = radio_group.find_elements(By.CSS_SELECTOR, 'div[role="radio"]')
|
50 |
+
# Use weighted random choice to add more randomness
|
51 |
random.choice(options).click()
|
52 |
|
53 |
# Handling checkboxes
|
54 |
checkboxes = driver.find_elements(By.CSS_SELECTOR, 'div[role="checkbox"]')
|
55 |
for checkbox in checkboxes:
|
56 |
+
if random.random() < 0.5: # 50% chance to click a checkbox
|
57 |
checkbox.click()
|
58 |
|
59 |
# Handling multiple choice grids
|
|
|
62 |
rows = grid.find_elements(By.CSS_SELECTOR, 'div[role="row"]')
|
63 |
for row in rows:
|
64 |
options = row.find_elements(By.CSS_SELECTOR, 'div[role="radio"]')
|
65 |
+
# Shuffle options before making a random selection to increase randomness
|
66 |
+
random.shuffle(options)
|
67 |
random.choice(options).click()
|
68 |
|
69 |
# Submit the form
|
|
|
80 |
)
|
81 |
|
82 |
# Wait and reload the form
|
83 |
+
time.sleep(random.uniform(3, 7)) # Vary the wait time to add randomness
|
84 |
driver.get(url)
|
85 |
|
86 |
except Exception as e:
|
|
|
128 |
for i in range(remaining_iterations):
|
129 |
futures.append(executor.submit(self.fill_form, url, 1, update_callback, i + 1))
|
130 |
for future in futures:
|
131 |
+
future.result()
|