-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmouse_roller+swipe_out.py
More file actions
51 lines (43 loc) · 1.98 KB
/
Copy pathmouse_roller+swipe_out.py
File metadata and controls
51 lines (43 loc) · 1.98 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
# Required Libraries
# Python3.XX & "pip install selenium" , "pip install pyautogui"
# C:\Users\psreemon\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.13_qbz5n2kfra8p0\LocalCache\local-packages\Python313\Scripts
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.keys import Keys
import pyautogui as screen
import time, os, random
# Keeps the Screen Awake. For mentioned period of MINUTES
min = int(input("Enter the Swipe script postpone TIME in MINUTES: "))
x, y = screen.size()
#while True:
for i in range(min): # collection of numbers from 0 to 9
min_left=min-i
print(min_left ," Minutes Left")
x1 = random.randint(0, x)
y1 = random.randint(0, y)
screen.moveTo(x1, y1); time.sleep(30)
screen.click(int(x/2), y-30); time.sleep(30)
# Opens the Chrome
driver = webdriver.Chrome(executable_path="D:\psreemon\Drivers\chromedriver116.exe")
driver.maximize_window()
driver.get("https://company.greythr.com/v3/portal/ess/home")
# Input Variables
uid = "0295"
pwd = "Password@1234"
swipe_button = "/html/body/app/ng-component/div/div/div[2]/div/ghr-home/div[2]/div/gt-home-dashboard/div/div[2]/gt-component-loader/gt-attendance-info/div/div/div[3]/gt-button[1]"
# Page1 - Login Process
WebDriverWait(driver, timeout=120).until(EC.presence_of_element_located((By.ID, "username")))
driver.find_element("id", "username").send_keys(uid)
driver.find_element("id", "password").send_keys(pwd)
driver.find_element("id", "password").send_keys(Keys.RETURN)
# Page2 - Sign out Process
WebDriverWait(driver, timeout=120).until(EC.element_to_be_clickable((By.XPATH, swipe_button)))
time.sleep(5)
driver.find_element(By.XPATH, value=swipe_button).click()
# Bye bye, Time to Shut Down your PC
driver.get("https://media.tenor.com/BP1T4u_j2nsAAAAd/nope-dbl.gif")
time.sleep(14.5)
driver.close()
os.system("shutdown /s /t 1")