Here is the HTML. I want to use the dynamic xpath here to get the text of the header elements.
<div class="w3-bar w3-theme w3-card-2 w3-wide notranslate">
<a class="w3-bar-item w3-button w3-hover-white w3-padding-16 hidesm" onclick="w3_open()" href="javascript:void(0)">
<a id="navbtn_tutorials" class="w3-bar-item w3-button barex w3-hover-white w3-padding-16" onclick="w3_open_nav('tutorials')" href="javascript:void(0)">
TUTORIALS
<i class="fa fa-caret-down"></i>
<i class="fa fa-caret-up" style="display:none"></i>
</a>
hElements = "//div[@class='w3-bar w3-theme w3-card-2 w3-wide notranslate']//a"
#is my xpath fetches all the header elements
hElementsSize = len(browser.driver.find_elements_by_xpath(hElements))
#fetches the size of the header elements
print("Total Header Elements:", hElementsSize)
hElementsText = browser.driver.find_element_by_xpath(hElements).text
print(hElementsText)
#i'm not able to get the text of the header elements