-
Notifications
You must be signed in to change notification settings - Fork 0
/
dell_support.py
executable file
·157 lines (137 loc) · 5.54 KB
/
dell_support.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
#!/usr/bin/python3
import click
import form_details
import sys
import re
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as ec
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import Select
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary
@click.command()
@click.argument('service_tag')
@click.option('--force', is_flag=True, default=False, help='Force the ticket submission and close the browser.')
def log_ticket(service_tag, force):
"""
SERVICE_TAG: Dell Service Tag consisting of 7 alphanumeric characters
depends on Firefox, Selenium and Click
\b
'pip3 install selenium'
'pip3 install click'
Create 'form_details.py' containing your contact details/support information:
\b
# Primary contact
company = ''
address0 = ''
address1 = ''
city = ''
country = '' # 2 letter country code, eg: AU
state = ''
zip_code = ''
primary_first_name = ''
primary_last_name = ''
primary_phone_number = ''
primary_email = ''
\b
# Secondary contact
secondary_first_name = ''
secondary_last_name = ''
secondary_phone_number = ''
secondary_email = ''
\b
# Support details, examples provided
problem_details = '900GB 10k SAS6 - hard drive predicted failure'
error_message = 'Predictive failure reported'
troubleshoot = 'Drive replaced with spare.'
incident_type = 'Hard-Drive_Floppy_Zip-Drive'
Incident types can be:
'Audio'
'Audio_Speakers'
'Battery'
'BIOS'
'CD-ROM'
'Connection'
'Damage'
'Driver'
'DVD_CD RW_CD ROM'
'Fan_Temperature'
'Fiber Channel'
'Hard-Drive_Floppy_Zip-Drive'
'iSCSI'
'Keyboard_Mouse'
'MemoryError'
'Modem_FAX'
'Monitor'
'Network'
'Network Adapter'
'No Power'
'OpenManage Software'
'Operating System'
'Other Dont Know'
'Poor Performance'
'Port Replicator'
'Power Supply'
'Printer_Scanner_Camera'
'Processory Error'
'Rack Hardware'
'RAID'
'Reboots_Locksup'
'Tape Backup'
'Update-Software BIOS'
'Upgrade-Hardware'
'Upgrade-Software'
'Video'
'VideoAdapter_LCD'
"""
# Check service tag format
valid = re.compile(r'^[A-Za-z0-9]{7}$')
if not re.match(valid, service_tag):
print("Service tag should be 7 alphanumeric characters")
sys.exit(1)
# If your system Firefox is older than 47.0.1, specify a newer version:
# binary = FirefoxBinary('/home/user/Downloads/firefox/firefox')
binary = FirefoxBinary('firefox')
# Start up web driver
driver = webdriver.Firefox(firefox_binary=binary)
driver.get("http://www.dell.com/support/incidents/au/en/aubsd1/Email/Welcome")
assert "Email Technical Support" in driver.title
elem_tag = driver.find_element_by_id("ServiceTag")
elem_tag.send_keys(service_tag)
elem_tag.send_keys(Keys.RETURN)
WebDriverWait(driver, 10).until(ec.presence_of_element_located(
(By.CLASS_NAME, "uif5_btnTxt"))).click()
WebDriverWait(driver, 10).until(ec.presence_of_element_located(
(By.ID, "CompanyName"))).send_keys(form_details.company)
driver.find_element_by_id("StreetAddress").send_keys(form_details.address0)
driver.find_element_by_id("StreetAddress1").send_keys(form_details.address1)
driver.find_element_by_id("City").send_keys(form_details.city)
Select(driver.find_element_by_id("NewCountry")).select_by_value(form_details.country)
Select(driver.find_element_by_id("NewState")).select_by_value(form_details.state)
driver.find_element_by_id("Zip").send_keys(form_details.zip_code)
driver.find_element_by_id("PrimaryFirstName").send_keys(form_details.primary_first_name)
driver.find_element_by_id("PrimaryLastName").send_keys(form_details.primary_last_name)
driver.find_element_by_id("PrimaryPhoneNumber").send_keys(form_details.primary_phone_number)
driver.find_element_by_id("PrimaryEmail").send_keys(form_details.primary_email)
driver.find_element_by_id("ConfirmEmail").send_keys(form_details.primary_email)
driver.find_element_by_id("SecondaryFirstName").send_keys(form_details.secondary_first_name)
driver.find_element_by_id("SecondaryLastName").send_keys(form_details.secondary_last_name)
driver.find_element_by_id("SecondaryPhoneNumber").send_keys(form_details.secondary_phone_number)
driver.find_element_by_id("SecondaryEmail").send_keys(form_details.secondary_email)
driver.find_element_by_id("SecondaryConfirmEmail").send_keys(form_details.secondary_email)
driver.find_element_by_id("btnContinue").click()
Select(WebDriverWait(driver, 10)
.until(ec.presence_of_element_located(
(By.ID, "IncidentTypeID")))).select_by_value(form_details.incident_type)
Select(driver.find_element_by_id("NewOperatingSystem")).select_by_value("LINUX - OS")
Select(driver.find_element_by_id("NewOperatingSystemVersion")).select_by_value("LINUX - OS_ALL")
driver.find_element_by_id("ProblemDetails").send_keys(form_details.problem_details)
driver.find_element_by_id("ErrorMessage").send_keys(form_details.error_message)
driver.find_element_by_id("TroubleshootingSteps").send_keys(form_details.troubleshoot)
if force:
driver.find_element_by_id("btnContinue").click()
if WebDriverWait(driver, 10).until(ec.presence_of_element_located((By.ID, "sce_submittedHeading"))):
driver.quit()
if __name__ == '__main__':
log_ticket()