With Python Selenium, I want to click on a button "Add..." based on another div.
I cannot use the xpath following::div as spotted here because they are in different divs.
Basically, look for the first div text to contain some text and based on it, I want to click on button "Add..." on fourth div. This on a serie of Divs, as you can see on screenshot.
On example/code below, I want to find "Template 1" <- xpath //*[@id="app"]/div/div[3]/div/div[24]/div[1]/div/h3/text()[1]
and base on that
I want to click on button 'Add...' <- xpath //*[@id="app"]/div/div[3]/div/div[24]/div[4]/div/table/thead/tr/th[3]/button
<div style="margin-bottom: 50px;" class="">
<div>
<div>
<h3>
<!-- react-text: 1148 -->Template 1<!-- /react-text --><!-- react-text: 1149 --> <!-- /react-text -->
</h3>
</div>
</div>
<div class="btn-group btn-table-action pull-right" style="vertical-align: top; top: -32px;"><button type="button" class="btn btn-link"><i class="fa fa-pencil-square-o" style="color: rgb(51, 122, 183);"></i></button><button type="button" class="btn btn-link"><i class="fa fa-trash-o" style="color: rgb(217, 83, 79);"></i></button></div>
<div class="detail-pane" style="background-color: rgb(245, 245, 245); border-radius: 4px; font-size: 90%; padding: 4px 20px; margin-bottom: 14px;">
<div>
<h5></h5>
<dl class="dl-horizontal">
<span>
<dt style="font-weight: normal;">Key</dt>
<dd style="font-weight: normal;">template-1-key</dd>
</span>
</dl>
</div>
</div>
<div>
<h5 style="color: rgb(95, 94, 94); margin-top: 27px;">Templates</h5>
<div class="detail-pane" style="background-color: rgb(245, 245, 245); border-radius: 4px; font-size: 90%; padding: 4px 20px; margin-bottom: 14px;">
<table class="table table-hover" style="table-layout: fixed;">
<thead>
<tr>
<th>Language</th>
<th>Asset Path</th>
<th>
<button type="button" class="btn btn-primary pull-right btn-xs" style="margin-left: 6px;">
<span>
<i class="fa fa-plus-square-o"> </i><!-- react-text: 1174 -->Add...<!-- /react-text -->
</span>
</button>
</th>
</tr>
</thead>
<tbody>
<tr>
<td colspan="3">No entries found so far...</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>

//*[@id="app"]/div/div[3]/div/div[4]. The button are all the same, no id.div? What is the text?