-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathweb-page.py
66 lines (50 loc) · 1.69 KB
/
web-page.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
#Script to filter last mail from the outlook
import pyperclip
import win32com.client,sys
from datetime import datetime
from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
from selenium.webdriver import ActionChains
from selenium.webdriver.common.keys import Keys
import pyautogui as py
outlook = win32com.client.Dispatch("Outlook.Application").GetNamespace("MAPI")
inbox = outlook.GetDefaultFolder(6) # "6" refers to the index of a folder - in this case,
#the inbox. You can change that number to reference
# any other folder
messages = inbox.Items
#Get the emAIL/S
message = messages.GetLast()
#Get today's date
today = datetime.now()
body_content = message.Subject
print(today)
print(body_content)
f = open("test.txt",'w')
f.write(body_content)
#f.write(today)
f.close()
f= open("test.txt",'r')
for ln in f:
ln = ln.rstrip()
id = ln.split()
ticket_id = id[1]
pyperclip.copy(ticket_id)
#we are getting into the chrome and doing copy paste & stuffs
driver = webdriver.Chrome(ChromeDriverManager().install())
driver.maximize_window()
url="https://www.google.com"
driver.get(url)
an = 'aan'
#inplace of "q" you can give the name that is right in you search bar
user_input = driver.find_element_by_name('q')
user_input.click()
user_input.send_keys(ticket_id)
action=ActionChains(driver)
#to understand how select and copy works
#ignore these three lines if not necessary
click =driver.find_element_by_name('q')
action.double_click(click).perform()
action.key_down(Keys.CONTROL).send_keys("c").perform()
#press enter
driver.find_element_by_name("q").send_keys(Keys.ENTER)
#you ,made some changes here