i am trying to fetch data from a svg element(graph). iam using x path with name() functionality but still it is returning empty strings.. my code from python was
outer_html_1 = self.driver.find_elements(By.XPATH,"//*[local-name()='svg' and @class='nvd3-svg']//*[local-name()='g' and @class='nvd3 nv-wrap nv-lineChart']//*[local-name()='g' and @class='nv-focus']//*[local-name()='g' and @class='nvd3 nv-wrap nv-line']//*[local-name()='g']//*[local-name()='g' and @class='nv-groups']//*[local-name()='g' and @class='nv-group nv-series-2']//*[local-name()='path' and @class='nv-line']")
print(outer_html_1)
let me know if i am missing any thing... i want to answers
You can directly access the element and print the text value ( unless it is hidden behind a iframe).
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
data = WebDriverWait(self.driver, 30).until(EC.presence_of_element_located((By.XPATH, "//g/path[@class='nv-line']")))
print(data.get_attribute("d"))
# This should print the value from the attribute "d"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.