I want to access the the last text of a message that contains three numbers that will provide me accesses to a url. I've looked into this solution, but it's not helping.
<div class="alert alert-danger" id="error_explanation">
<h4>The form contains the following error:</h4>
<ul>
<li>
"Validate branches Another open merge request already exist for this source branch: !323"
</li>
</ul>
</div>
I currently have
string sourcePath = ".//div[contains(text(),'Validate branches Another open')][last()]";
string urlPath = driver.findElement(By.xpath(sourcePath)).getText();
driver.navigate.to(driver.getCurrentUrl()+urlPath);
But I am told that no element exist. I want to access the !323 and attach/navigate to the url