-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathautomated_big_boss_voting.py
More file actions
56 lines (36 loc) · 1.73 KB
/
Copy pathautomated_big_boss_voting.py
File metadata and controls
56 lines (36 loc) · 1.73 KB
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
from selenium import webdriver
import os
import time
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.keys import Keys
#Make sure your chrome binary is at the correct location , in this case it is in the same level of this script
PROJECT_ROOT = os.path.abspath(os.path.dirname(__file__))
DRIVER_BIN = os.path.join(PROJECT_ROOT, "chromedriver")
browser = webdriver.Chrome(executable_path = DRIVER_BIN)
# To vote for a contestant we need to login to gmail
browser.get('http://gmail.com')
emailElem = browser.find_element_by_id('identifierId')
# fill in your gmail user name
emailElem.send_keys('replace_with_your_gmail_username')
nextButton = browser.find_element_by_id('identifierNext')
nextButton.click()
time.sleep(3)
password = WebDriverWait(browser, 5).until(
EC.element_to_be_clickable((By.XPATH, "//input[@name='password']"))
)
# fill in your gmail password
password.send_keys("replae_with_your_gmail_username")
browser.find_element_by_id("passwordNext").click()
time.sleep(8)
#open tab
browser.find_element_by_tag_name('body').send_keys(Keys.COMMAND + 't')
# You can use (Keys.CONTROL + 't') on other OSs
# Load a page
browser.get('https://www.google.co.in/search?q=big+boss+telugu+vote+2018&oq=big+b&aqs=chrome.0.69i59j69i57j69i59l2j69i61j69i60.1309j0j1&sourceid=chrome&ie=UTF-8')
elm = browser.find_element_by_css_selector("[data-id='bbtelugu201808kaushal']").click()
time.sleep(5)
browser.find_element_by_css_selector("[aria-valuemax='50']").click()
browser.find_element_by_css_selector(".fSXkBc").click()
browser.find_element_by_css_selector("[data-async-trigger='submit']").click()