Is there a way to select and click the blog title without relying on the text, which can change frequently? Unfortunately, I don't have an "li" tag, so my previous methods aren't working in this scenario. Any assistance would be greatly appreciated.
Here is the latest approach I've attempted:
driver.findElement(By.xpath("(//h2[contains(@class, 'blog-post-title')])[3]/a")).click();
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<div class="view-content">
<div class="views-row views-row-1">
<span class="pubdate">July 31, 2012</span>
<h2 class="blog-post-title"><a href=
"/blogs/roadscholar/the-surprise-attack-and-when-not-to-do-it">The
Surprise Attack (And When Not to Do It)</a></h2>
<p class='field-summary'>With 200 meters remaining in the
250-kilometer Men’s Olympic Road Race last Saturday, Colombia’s
Rigoberto Uran made a fatal mistake: He turned his head to see what
was happening behind him....</p><a class="read-more" href=
"/blogs/roadscholar/the-surprise-attack-and-when-not-to-do-it">Read
more</a>
<ul class="links inline">
<li class="datetime first"><span>Posted at <time class=
"timestamp" datetime="2012-07-31T17:41:04-04:00">5:41
PM</time></span></li>
<li class="disqus_comments_num"><a data-disqus-identifier=
"node/28978" href=
"/blogs/roadscholar/the-surprise-attack-and-when-not-to-do-it#disqus_thread">
Comments</a></li>
... [additional unchanged HTML content] ...
</div>
</div>
</body>
</html>