E
Emsen
Guest
Hello, im making a program using webbrowser. I stuck on getting specific value, because it has no id or class.
<table id="plunder_list" style="width:100%;">
<tbody><tr>
<th rowspan="2"><img src="https://dspl.innogamescdn.com/8.144/38929/graphic/delete_small.png" title="" alt="" class=""></th>
<th rowspan="2"> </th>
<th rowspan="2"> </th>
<th rowspan="2">Wioska</th>
<th rowspan="2"><a href="/game.php?village=39099&screen=am_farm&&order=date&dir=asc">Czas</a></th>
<th colspan="3" class="center" rowspan="2">
<span class="icon header ressources"> </span>
</th>
<th rowspan="2"><img src="https://dspl.innogamescdn.com/8.144/38929/graphic/buildings/wall.png" class=""></th>
<th rowspan="2"><a href="/game.php?village=39099&screen=am_farm&&order=distance&dir=asc"><img src="https://dspl.innogamescdn.com/8.144/38929/graphic/rechts.png" class=""></a></th>
<th rowspan="2" colspan="1">
<img src="https://dspl.innogamescdn.com/8.144/38929/graphic/questionmark.png" class="" width="13" height="13">
</th>
<th rowspan="2"><img src="https://dspl.innogamescdn.com/8.144/38929/graphic/questionmark.png" class="" width="13" height="13"></th>
<th rowspan="2"><img src="https://dspl.innogamescdn.com/8.144/38929/graphic/buildings/place.png" class=""></th>
</tr>
<tr></tr>
<tr id="village_38939" class="report_38939 row_a">
<td><a onclick="return Accountmanager.farm.deleteReport(38939);" class="" href="#"><img src="https://dspl.innogamescdn.com/8.144/38929/graphic/delete_small.png" title="" alt="" class=""></a></td>
<td><img src="https://dspl.innogamescdn.com/8.144/38929/graphic/dots/green.png" class=""> </td>
<td><img src="https://dspl.innogamescdn.com/8.144/38929/graphic/max_loot/1.png" class=""> </td>
<td><a href="/game.php?village=39099&screen=report&mode=all&view=17150309"> (338|400) K43 </a></td>
<td>wczoraj o 20:29:05</td>
<td style="text-align: center;" colspan="3">
<span class="">?</span>
</td>
<td style="text-align: center;">?</td>
<td>2.8</td>
<td>
<a href="#" onclick="return Accountmanager.farm.sendUnits(this, 38939, 16696)" class="farm_village_38939 farm_icon farm_icon_a"></a>
</td>
<td style="text-align: center">
<span class="">?</span>
</td>
<td><a href="/game.php?village=39099&screen=place&target=38939&" onclick="Accountmanager.farm.openRallyPoint(38939, event)"><img src="https://dspl.innogamescdn.com/8.144/38929/graphic/buildings/place.png" title="" alt="" class=""></a></td>
</tr> <tr id="village_38345" class="report_38345 row_b">
<td><a onclick="return Accountmanager.farm.deleteReport(38345);" class="" href="#"><img src="https://dspl.innogamescdn.com/8.144/38929/graphic/delete_small.png" title="" alt="" class=""></a></td>
<td><img src="https://dspl.innogamescdn.com/8.144/38929/graphic/dots/green.png" class=""> </td>
<td><img src="https://dspl.innogamescdn.com/8.144/38929/graphic/max_loot/0.png" class=""> </td>
<td><a href="/game.php?village=39099&screen=report&mode=all&view=17141844"> (339|400) K43 </a></td>
<td>wczoraj o 20:17:56</td>
<td style="text-align: center;" colspan="3">
<span class="">?</span>
</td>
<td style="text-align: center;">?</td>
<td>3.6</td>
<td>
<a href="#" onclick="return Accountmanager.farm.sendUnits(this, 38345, 16696)" class="farm_village_38345 farm_icon farm_icon_a"></a>
</td>
<td style="text-align: center">
<span class="">?</span>
</td>
<td><a href="/game.php?village=39099&screen=place&target=38345&" onclick="Accountmanager.farm.openRallyPoint(38345, event)"><img src="https://dspl.innogamescdn.com/8.144/38929/graphic/buildings/place.png" title="" alt="" class=""></a></td>
</tr> </tbody></table>
I need to get the value from
<td>2.8</td>
and compare it
if ( this.value <3)
Click on
<a href="#" onclick="return Accountmanager.farm.sendUnits(this, 38939, 16696)" class="farm_village_38939 farm_icon farm_icon_a"></a>
As you can see there is other similar line
<td>3.6</td>
which i want to compare also
Condition is not match so my program shouldnt click on
<a href="#" onclick="return Accountmanager.farm.sendUnits(this, 38345, 16696)" class="farm_village_38345 farm_icon farm_icon_a"></a>
How can i accomplish this. I was searching through similiar topics, but unfortunatelly i didnt find any solution.
I want to implement this code in
foreach (HtmlElement s in webbrowser1.Document.GetElementByTagName("*")
{
}
I dont want to download source page and read this by StreamReader, Xpath solutions also wont work. This should get the value, compare it and if condition matches click on specific element, same for other similar values.
Hardly need your help.
Continue reading...
<table id="plunder_list" style="width:100%;">
<tbody><tr>
<th rowspan="2"><img src="https://dspl.innogamescdn.com/8.144/38929/graphic/delete_small.png" title="" alt="" class=""></th>
<th rowspan="2"> </th>
<th rowspan="2"> </th>
<th rowspan="2">Wioska</th>
<th rowspan="2"><a href="/game.php?village=39099&screen=am_farm&&order=date&dir=asc">Czas</a></th>
<th colspan="3" class="center" rowspan="2">
<span class="icon header ressources"> </span>
</th>
<th rowspan="2"><img src="https://dspl.innogamescdn.com/8.144/38929/graphic/buildings/wall.png" class=""></th>
<th rowspan="2"><a href="/game.php?village=39099&screen=am_farm&&order=distance&dir=asc"><img src="https://dspl.innogamescdn.com/8.144/38929/graphic/rechts.png" class=""></a></th>
<th rowspan="2" colspan="1">
<img src="https://dspl.innogamescdn.com/8.144/38929/graphic/questionmark.png" class="" width="13" height="13">
</th>
<th rowspan="2"><img src="https://dspl.innogamescdn.com/8.144/38929/graphic/questionmark.png" class="" width="13" height="13"></th>
<th rowspan="2"><img src="https://dspl.innogamescdn.com/8.144/38929/graphic/buildings/place.png" class=""></th>
</tr>
<tr></tr>
<tr id="village_38939" class="report_38939 row_a">
<td><a onclick="return Accountmanager.farm.deleteReport(38939);" class="" href="#"><img src="https://dspl.innogamescdn.com/8.144/38929/graphic/delete_small.png" title="" alt="" class=""></a></td>
<td><img src="https://dspl.innogamescdn.com/8.144/38929/graphic/dots/green.png" class=""> </td>
<td><img src="https://dspl.innogamescdn.com/8.144/38929/graphic/max_loot/1.png" class=""> </td>
<td><a href="/game.php?village=39099&screen=report&mode=all&view=17150309"> (338|400) K43 </a></td>
<td>wczoraj o 20:29:05</td>
<td style="text-align: center;" colspan="3">
<span class="">?</span>
</td>
<td style="text-align: center;">?</td>
<td>2.8</td>
<td>
<a href="#" onclick="return Accountmanager.farm.sendUnits(this, 38939, 16696)" class="farm_village_38939 farm_icon farm_icon_a"></a>
</td>
<td style="text-align: center">
<span class="">?</span>
</td>
<td><a href="/game.php?village=39099&screen=place&target=38939&" onclick="Accountmanager.farm.openRallyPoint(38939, event)"><img src="https://dspl.innogamescdn.com/8.144/38929/graphic/buildings/place.png" title="" alt="" class=""></a></td>
</tr> <tr id="village_38345" class="report_38345 row_b">
<td><a onclick="return Accountmanager.farm.deleteReport(38345);" class="" href="#"><img src="https://dspl.innogamescdn.com/8.144/38929/graphic/delete_small.png" title="" alt="" class=""></a></td>
<td><img src="https://dspl.innogamescdn.com/8.144/38929/graphic/dots/green.png" class=""> </td>
<td><img src="https://dspl.innogamescdn.com/8.144/38929/graphic/max_loot/0.png" class=""> </td>
<td><a href="/game.php?village=39099&screen=report&mode=all&view=17141844"> (339|400) K43 </a></td>
<td>wczoraj o 20:17:56</td>
<td style="text-align: center;" colspan="3">
<span class="">?</span>
</td>
<td style="text-align: center;">?</td>
<td>3.6</td>
<td>
<a href="#" onclick="return Accountmanager.farm.sendUnits(this, 38345, 16696)" class="farm_village_38345 farm_icon farm_icon_a"></a>
</td>
<td style="text-align: center">
<span class="">?</span>
</td>
<td><a href="/game.php?village=39099&screen=place&target=38345&" onclick="Accountmanager.farm.openRallyPoint(38345, event)"><img src="https://dspl.innogamescdn.com/8.144/38929/graphic/buildings/place.png" title="" alt="" class=""></a></td>
</tr> </tbody></table>
I need to get the value from
<td>2.8</td>
and compare it
if ( this.value <3)
Click on
<a href="#" onclick="return Accountmanager.farm.sendUnits(this, 38939, 16696)" class="farm_village_38939 farm_icon farm_icon_a"></a>
As you can see there is other similar line
<td>3.6</td>
which i want to compare also
Condition is not match so my program shouldnt click on
<a href="#" onclick="return Accountmanager.farm.sendUnits(this, 38345, 16696)" class="farm_village_38345 farm_icon farm_icon_a"></a>
How can i accomplish this. I was searching through similiar topics, but unfortunatelly i didnt find any solution.
I want to implement this code in
foreach (HtmlElement s in webbrowser1.Document.GetElementByTagName("*")
{
}
I dont want to download source page and read this by StreamReader, Xpath solutions also wont work. This should get the value, compare it and if condition matches click on specific element, same for other similar values.
Hardly need your help.
Continue reading...