I would like to extract the following text fields that are located within a g tag which is located in a svg tag (the url: https://www.msci.com/our-solutions/esg-investing/esg-ratings-climate-search-tool). I put in a company name and search for it, expand the last drop down menu and want to extract information from the <svg>.
HTML Part I:

HTML Part II:

I tried what has been suggested here: Extracting text from svg using python and selenium but I did not mange to get it.
My code:
test = driver.find_element(By.XPATH, "//*[local-name()='svg' and @class='highcharts-root']//*[local-name()='g' and @class='highcharts-axis-labels highcharts-xaxis-labels']//*[name()='text']").text
print(test)
To extract the texts e.g.
Sep-18,Nov-22you have to induce WebDriverWait for visibility_of_all_elements_located() and you can use either of the following locator strategies:Using CSS_SELECTOR and text attribute:
Using XPATH and
get_attribute("innerHTML"):Note : You have to add the following imports :
References
You can find a couple of relevant detailed discussions in: