-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart.rb
More file actions
45 lines (31 loc) · 889 Bytes
/
start.rb
File metadata and controls
45 lines (31 loc) · 889 Bytes
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
require 'awesomeprint'
require 'Credentials'
require 'watir'
require 'pry'
require 'rb-readline'
count = 0
username = $username
password = $password
chdriver = Watir::chdriver.new :chrome, switches: ['--incognito']
chdriver.goto "https://www.instagram.com/accounts/login/"
ap "trying to login"
chdriver.text_field(:name => "username").set "#{username}"
chdriver.text_field(:name => "password").set "#{password}"
chdriver.button(:class => '_ah57t _84y62 _i46jh _rmr7s').click
sleep(8)
while True
3.times do |i|
chdriver.driver.execute_script("window.scrollBy(0,document.body.scrollHeight)")
sleep(8)
enabled
if chdriver.span(:class => "coreSpriteLikeHeartOpen").exists?
chdriver.spans(:class => "coreSpriteLikeHeartOpen").each { |val|
val.click
count += 1
}
ap "Liked => #{count}"
else
ap "nothing to lilke"
end
sleep(30)
end