-
Notifications
You must be signed in to change notification settings - Fork 0
/
WebAutomation.py
44 lines (32 loc) · 1.2 KB
/
WebAutomation.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
import os
import datetime
import pyautogui
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from Vendors import vendors
username = os.getlogin()
path = f"C:\\Users\{username}\Desktop\RSPO-SCC-Review-main\msedgedriver.exe"
PATH = path
driver = webdriver.Edge(PATH)
now = datetime.datetime.now()
original_path = (f"C:\\Users\{username}\Desktop\RSPO-SCC-Review-main")
folder_date = str(now.strftime("%Y-%m-%d"))
new_path = original_path+'\\'+folder_date
if not os.path.exists(new_path):
os.mkdir(new_path)
print("Created Directory")
else:
print("Directory already existed")
for vendor in vendors:
driver.get("https://rspo.secure.force.com/membership/RSPOSCCSearch")
driver.maximize_window()
driver.implicitly_wait(5)
search = driver.find_element("id", "j_id0:j_id51:input-keyword")
search.send_keys(vendor)
search.send_keys(Keys.RETURN)
driver.implicitly_wait(5)
status = driver.find_element("id","j_id0:searchresults:0:j_id100")
pyautogui.screenshot().save(new_path+'\\'+vendor+'.png')
print(vendor, "is", status.text, "as of", now.strftime("%Y-%m-%d %H:%M:%S"))
driver.implicitly_wait(5)
driver.close()