Erwan Erwan - 7 months ago 19
Java Question

Syntax error on selenium xpath expression

I'm building a selenium

findElement by.xpath
expression, very complex, and it appears there is a syntax error.

I don't really know XML language so I made mistake(s) obviously, could someone tell where are the mistake(s) ? :)


I have a list of projects on a web page, in each project there are sub-projects, I want a specific one, I know the
and the

The html code is something like :

<table id="list_proj" class="table tablebas table-striped table-bordered">
<tbody style="height:1em;overflow-y:scroll"></tbody>
<tbody style="height:1em;overflow-y:scroll"></tbody>
<tbody style="height:1em;overflow-y:scroll">
<tr class="caption">
<td class="app_name" style="background-color:#EFEFEF;" colspan="11">
<a href="?page=applications&mode=edit&app_id=3" style="padding-left:10px;" data-icon=""> Application SEVo</a>
<tr class="data"></tr>
<tr class="data"></tr>
<tr class="data">
<td title="Pas de commentaire !" style="text-align:left">
<img alt="MCO" src="/colibri/images/corner-dots.gif"></img>
<a href="?page=projects&mode=view&project_id=9" style="padding-left:5px">MCO</a>
<td colspan="2">
<tr class="data">
<tbody style="height:1em;overflow-y:scroll"></tbody>

And my xpath expression :


Sorry for the mess ^^'


It should be something like:


Don't use index [1] everytime, If you are sure that only one element would be returned, there is no point of putting index in every descendant or ancestor call.