I'm running into an issue where when I try to use a macro into the xpath, it doesn't work and no errors pop up. It clicks an area that doesn't match with the xpath. I use the chrome webdriver.
My code:
dob = 'Apr 18, 1967'
driver.find_element_by_xpath("//span[contains(., dob)]").click()
It works when I don't use the macro
driver.find_element_by_xpath("//span[contains(., 'Apr 18, 1967')]").click()
This is the area I am trying to interact with:
<span class="m-list-search__result-item-text">LastName, FirstName (Apr 18, 1967)</span>
This is what it interacts with when I use the macro in xpath:
<div id="sidePanelCollapseButton" class="m-stack__item m-stack__item--middle m-brand__tools">
I've tried locating with the class but the xpath for that would return several 10s of results, so going by the DOB is the easiest way to narrow it down.