-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMaintenance_and_Service_Guide.py
53 lines (45 loc) · 3.98 KB
/
Maintenance_and_Service_Guide.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
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from msedge.selenium_tools import Edge, EdgeOptions
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
import time
from selenium.common.exceptions import NoSuchElementException
# Function which returns the URL of the Maintenance and Service Guide
def Maintenance_and_Service_Guide_Link(driver):
manuals = driver.find_element_by_id('manuals')
manuals.click()
try:
maintenance_and_service_guide_text = driver.find_element_by_xpath("//tbody[@id='userGuidesList']/tr/td/a/*[contains(text(), 'Maintenance and Service Guide')]")
driver.execute_script("arguments[0].scrollIntoView();", maintenance_and_service_guide_text)
driver.execute_script("arguments[0].click();", maintenance_and_service_guide_text)
maintenance_and_service_guide_page = maintenance_and_service_guide_text.find_element_by_xpath('..').get_attribute('href')
driver.switch_to.window(driver.window_handles[3])
return maintenance_and_service_guide_page
except NoSuchElementException:
return None
# Function which adds the information pertaining to the Maintenance and Service Guide to the final answer
def Maintenance_and_Service_Guide_Answer(driver, device, page, url, full_product_name):
device.final_answer += '<hr /><p><font size="5"><strong>Maintenance and Service Guide</strong></font></p>'
if page == "No Page":
device.final_answer += '<p><strong><a href="%s" target="_blank" rel="noopener">Maintenance and Service Guide</a> for the %s.</strong></p><p> </p>' % (url, full_product_name)
device.final_answer += '''<p>By choosing to use the Maintenance and Service Guide to make hardware changes to the device,
the user acknowledges that HP is not liable for any accidental damage inflicted upon the device
and that modifications are not covered under HP's standard warranty. For additional protection
in the case of accidental damage, refer to HP's ADP plans for your product.</p><p> </p>
<p class="lia-align-center">Full details on <a href="https://www8.hp.com/us/en/privacy/limited_warranty.html"
target="_blank" rel="noopener">HP's Worldwide Limited Warranty and Technical Support</a>.</p>p> </p>
<p class="lia-align-center">Full details on <a href="https://support.hp.com/ca-en/document/c05805564"
target="_blank" rel="noopener">Damage Not Covered by the HP Standard Limited Warranty</a>.</p>'''
return
else:
url += "#page=%s" % page
device.final_answer += '<p><strong>Page %s of the <a href="%s" target="_blank" rel="noopener">Maintenance and Service Guide</a> for the %s.</strong></p><p> </p>' % (page, url, full_product_name)
device.final_answer += '''<p>By choosing to use the Maintenance and Service Guide to make hardware changes to the device,
the user acknowledges that HP is not liable for any accidental damage inflicted upon the device
and that modifications are not covered under HP's standard warranty. For additional protection
in the case of accidental damage, refer to HP's ADP plans for your product.</p><p> </p>
<p class="lia-align-center">Full details on <a href="https://www8.hp.com/us/en/privacy/limited_warranty.html"
target="_blank" rel="noopener">HP's Worldwide Limited Warranty and Technical Support</a>.</p><p> </p>
<p class="lia-align-center">Full details on <a href="https://support.hp.com/ca-en/document/c05805564"
target="_blank" rel="noopener">Damage Not Covered by the HP Standard Limited Warranty</a>.</p>'''