# import selenium
from selenium import webdriver
# lets you use the any by element statements
from selenium.webdriver.common.by import By
# start the webdriver for chrome
from selenium.webdriver.chrome.service import Service
# import locate_with for above, below
from selenium.webdriver.support.relative_locator import locate_with
# declare the path as the service using the letter s
s = Service('C:\ChromeDriver\chromedriver.exe')
# declare the web driver using the service as the browser
driver = webdriver.Chrome(service=s)
# declare the URL
url = 'https://msrc.microsoft.com/update-guide/vulnerability/CVE-2021-42321'
# get the url referenced above using the browser.get
driver.get(url)
# tells the driver to wait 10 seconds so the page can load the "DOM"
driver.implicitly_wait(10)
VN = driver.find_element(By.XPATH, '//h1').text
print("System Impacted: " + VN)
CVSS = driver.find_element(By.XPATH, '//*[@id="title"]/div/div/div/div[3]/div[1]/div/div/label').text
print("CVSS Detail is: " + CVSS)
**AV = driver.find_element(By.XPATH, '//summary[normalize-space()="Network"]').text
print("Attack Vector: " + AV)**
I am attempting to scan a URL and get relative information on the "attack vector" field
One of these is finding the value of the attack vector in different vulnerabilities - https://msrc.microsoft.com/update-guide/vulnerability/CVE-2021-42321
Each xpath is different for a CVE such as:
//summary[normalize-space()="Network"] or
//summary[normalize-space()="Local"] or
//summary[normalize-space()="Physical"]
when I input a different URL for the CVE each time, I want to print out one of those attack vectors depending on what the URL catches for the attack vector associated with the CVE