-
Notifications
You must be signed in to change notification settings - Fork 35
/
Copy pathexample.py
66 lines (49 loc) · 1.66 KB
/
example.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import time
import random
from behavior.behavior import humanMove, humanTyping
from behavior.sst_utils import *
"""
You might have to adjust some coordinates.
I used a dual screen setup and I started the browser on the
left screen.
You can obtain the coordinates of your current mouse pointer with
the bash command on Linux `xdotool getmouselocation`
"""
def main():
print('Trying to start browser')
startBrowser(['bot.incolumitas.com\n'])
# click link to get to the challenge
print('Trying to click challenge link')
coords = getCoords('li:nth-of-type(3) a')
print('Clicking on coordinates ' + str(coords))
humanMove(*coords)
time.sleep(random.uniform(0.5, 1.0))
# enter username
username = getCoords('input[name="userName"]')
humanMove(*username, clicks=2)
time.sleep(random.uniform(0.25, 1.25))
humanTyping('IamNotABotISwear\n', speed=(0.005, 0.008))
time.sleep(random.uniform(0.5, 1.0))
# enter email
email = getCoords('input[name="eMail"]')
humanMove(*email, clicks=3)
time.sleep(random.uniform(0.25, 1.25))
humanTyping('[email protected]\n', speed=(0.005, 0.008))
time.sleep(random.uniform(0.5, 1.0))
# agree to the terms
terms = getCoords('input[name="terms"]')
humanMove(*terms)
# select cats
cat = getCoords('#bigCat')
humanMove(*cat)
# submit
submit = getCoords('#submit')
humanMove(*submit)
# press the final enter
time.sleep(random.uniform(2.5, 3.4))
humanTyping('\n', speed=(0.005, 0.008))
# finally get the page source
text = getPageSource()
print('Got {} bytes of page soure'.format(len(text)))
if __name__ == '__main__':
main()