I am using the WebBrowser
object, for web automation purposes on a windows form .Net Framework 4.5 application. In a certain page, I am not able to see the id in my WebBrowser.DocumentText
even though I can see it when I open View page source from an actual browser.
This is the code that I always use to get the HtmlElement
inside a page.
var attack = wb.Document.GetElementById("target_attack");
To sum up how can I retrieve an ID that is not inside DocumentText but inside the page source ?
Edit: This is how it looks like in the Page Source data. Just press conrol + f and search for the id named troop_confirm_go
:
<table align="center" id="contentContainer" width="100%">
<tr>
<td>
<table class="content-border" width="100%" cellspacing="0">
<tr>
<td id="inner-border">
<table class="main" align="left">
<tr>
<td id="content_value">
<form id="command-data-form" action="/game.php?village=39143&screen=place&action=command&h=c86dc3bd" method="post" onsubmit="this.submit.disabled=true;">
<input type="hidden" name="attack" value="true" />
<h2>Barbar köyü hedefindeki saldırıyı onayla</h2>
<input type="hidden" name="ch" value="b5aa6baff4c83d16a08edb7709204aefd3e85650" />
<input type="hidden" name="x" value="489" />
<input type="hidden" name="y" value="690" />
<input type="hidden" name="source_village" value="39143">
<input type="hidden" name="action_id" value="1880595" />
<table class="vis" width="300">
<tr>
<th colspan="2">
Komut
</th>
</tr>
<tr><td>Hedef:</td><td><span class="village_anchor" data-player="0" data-id="42165"><a href="/game.php?village=39143&screen=info_village&id=42165" >Barbar köyü (489|690) K64</a></span></td></tr>
<tr><td>Süre:</td><td>0:40:15</td></tr>
<tr>
<td>Varış:</td>
<td id="date_arrival">
<span class="relative_time" data-duration="2415">
bugün saat 23:46
</span>
</td>
</tr>
<tr><td>Moral:</td><td><b>100%</b></td></tr> <tr><td colspan="2"><span class="icon header ressources" title="Taşıma kapasitesi"></span>250</td></tr> </table><br />
<table class="vis" id="place_confirm_units">
<tr>
<th class="train-ui" style="display: none"></th>
<th width="50"><a href="#" class="unit_link" data-unit="spear"><img src="https://dstr.innogamescdn.com/8.44.1/28599/graphic/unit/unit_spear.png" title="Mızrakçı" alt="" class="" /></a></th><th width="50"><a href="#" class="unit_link" data-unit="sword"><img src="https://dstr.innogamescdn.com/8.44.1/28599/graphic/unit/unit_sword.png" title="Kılıç Ustası" alt="" class="faded" /></a></th><th width="50"><a href="#" class="unit_link" data-unit="axe"><img src="https://dstr.innogamescdn.com/8.44.1/28599/graphic/unit/unit_axe.png" title="Baltacı" alt="" class="faded" /></a></th><th width="50"><a href="#" class="unit_link" data-unit="spy"><img src="https://dstr.innogamescdn.com/8.44.1/28599/graphic/unit/unit_spy.png" title="Casus" alt="" class="faded" /></a></th><th width="50"><a href="#" class="unit_link" data-unit="light"><img src="https://dstr.innogamescdn.com/8.44.1/28599/graphic/unit/unit_light.png" title="Hafif atlı" alt="" class="faded" /></a></th><th width="50"><a href="#" class="unit_link" data-unit="heavy"><img src="https://dstr.innogamescdn.com/8.44.1/28599/graphic/unit/unit_heavy.png" title="Ağır atlı" alt="" class="faded" /></a></th><th width="50"><a href="#" class="unit_link" data-unit="ram"><img src="https://dstr.innogamescdn.com/8.44.1/28599/graphic/unit/unit_ram.png" title="Şahmerdan" alt="" class="faded" /></a></th><th width="50"><a href="#" class="unit_link" data-unit="catapult"><img src="https://dstr.innogamescdn.com/8.44.1/28599/graphic/unit/unit_catapult.png" title="Mancınık" alt="" class="faded" /></a></th><th width="50"><a href="#" class="unit_link" data-unit="knight"><img src="https://dstr.innogamescdn.com/8.44.1/28599/graphic/unit/unit_knight.png" title="Şövalye" alt="" class="faded" /></a></th><th width="50"><a href="#" class="unit_link" data-unit="snob"><img src="https://dstr.innogamescdn.com/8.44.1/28599/graphic/unit/unit_snob.png" title="Misyoner" alt="" class="faded" /></a></th>
</tr>
<tr class="train-ui" style="display: none">
<th>Köy birimleri</th>
<td class='unit-item unit-item-spear '>10</td><td class='unit-item unit-item-sword '>10</td><td class='unit-item unit-item-axe hidden'>0</td><td class='unit-item unit-item-spy hidden'>0</td><td class='unit-item unit-item-light hidden'>0</td><td class='unit-item unit-item-heavy hidden'>0</td><td class='unit-item unit-item-ram hidden'>0</td><td class='unit-item unit-item-catapult hidden'>0</td><td class='unit-item unit-item-knight hidden'>0</td><td class='unit-item unit-item-snob hidden'>0</td>
</tr>
<tr class="units-row">
<th class="train-ui train-name" style="display: none"><span>Saldırı #1</span></th>
<td class='unit-item unit-item-spear '>10</td><td class='unit-item unit-item-sword hidden'>0</td><td class='unit-item unit-item-axe hidden'>0</td><td class='unit-item unit-item-spy hidden'>0</td><td class='unit-item unit-item-light hidden'>0</td><td class='unit-item unit-item-heavy hidden'>0</td><td class='unit-item unit-item-ram hidden'>0</td><td class='unit-item unit-item-catapult hidden'>0</td><td class='unit-item unit-item-knight hidden'>0</td><td class='unit-item unit-item-snob hidden'>0</td>
</tr>
<tr class="train-ui units-sum" style="display: none">
<th>Toplam</th>
<td class='unit-item unit-item-spear '>10</td><td class='unit-item unit-item-sword hidden'>0</td><td class='unit-item unit-item-axe hidden'>0</td><td class='unit-item unit-item-spy hidden'>0</td><td class='unit-item unit-item-light hidden'>0</td><td class='unit-item unit-item-heavy hidden'>0</td><td class='unit-item unit-item-ram hidden'>0</td><td class='unit-item unit-item-catapult hidden'>0</td><td class='unit-item unit-item-knight hidden'>0</td><td class='unit-item unit-item-snob hidden'>0</td>
</tr>
</table>
<br />
<input type="hidden" name="spear" value="10" />
<input type="hidden" name="sword" value="0" />
<input type="hidden" name="axe" value="0" />
<input type="hidden" name="spy" value="0" />
<input type="hidden" name="light" value="0" />
<input type="hidden" name="heavy" value="0" />
<input type="hidden" name="ram" value="0" />
<input type="hidden" name="catapult" value="0" />
<input type="hidden" name="knight" value="0" />
<input type="hidden" name="snob" value="0" />
<h3 class="error" id="train_noble_warning" style="display: none">
Misyonerler koruma olmadan gönderilmemeli!
</h3>
<input id="troop_confirm_go" style="margin-bottom: 5px" class="troop_confirm_go btn btn-attack" name="submit" type="submit" onload="this.disabled=false;" value="Saldırı gönder" />
<a href="#" id="troop_confirm_train" class="btn btn-img" style="display: none; line-height: 21px">
<img src="https://dstr.innogamescdn.com/8.44.1/28599/graphic/unit/tiny/snob.png" title="" alt="" class="" /> Misyoner saldırısı ekle
</a>
</form>
<script type="text/javascript">
$(document).ready(function() {
$('#troop_confirm_go').focus();
Place.confirmScreen.init({"type":"attack","units":["spear","sword","axe","spy","light","heavy","ram","catapult","knight","snob"],"send_units":{"spear":10,"sword":0,"axe":0,"spy":0,"light":0,"heavy":0,"ram":0,"catapult":0,"knight":0,"snob":0},"available_units":{"spear":10,"sword":10,"axe":0,"spy":0,"light":0,"heavy":0,"ram":0,"catapult":0,"knight":0,"snob":0}});
});
</script>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
<p class="server_info">
Sunucu saati: <span id="serverTime">23:05:56</span> <span id="serverDate">08/03/2016</span>
<span id="dev_console" style="display: none"><b>|</b> <a href="?screen=74:72:69:62:61:6c:77:61:72:73">developer console</a></span>
</p>
</td>
<td class="bg_right" id="SkyScraperAdCell">
<div class="bg_right"> </div>
<div id="SkyScraperAd">
<script type='text/javascript'><!--//<![CDATA[
var m3_u = (location.protocol=='https:'?'https://openx.innogames.de/delivery/ajs.php':'http://openx.innogames.de/delivery/ajs.php');
var m3_r = Math.floor(Math.random()*99999999999);
if (!document.MAX_used) document.MAX_used = ',';
document.write ("<scr"+"ipt type='text/javascript' src='"+m3_u);
document.write ("?zoneid=1620");
document.write ('&cb=' + m3_r);
if (document.MAX_used != ',') document.write ("&exclude=" + document.MAX_used);
document.write (document.charset ? '&charset='+document.charset : (document.characterSet ? '&charset='+document.characterSet : ''));
document.write ("&loc=" + escape(window.location));
if (document.referrer) document.write ("&referer=" + escape(document.referrer));
if (document.context) document.write ("&context=" + escape(document.context));
if (document.mmm_fo) document.write ("&mmm_fo=1");
document.write ("'><\/scr"+"ipt>");
//]]>--></script><noscript><a href='http://openx.innogames.de/delivery/ck.php?n=a47300e4&cb=INSERT_RANDOM_NUMBER_HERE' target='_blank'><img src='http://openx.innogames.de/delivery/avw.php?zoneid=1620&cb=INSERT_RANDOM_NUMBER_HERE&n=a47300e4' border='0' alt='' /></a></noscript>
</div>
</td>
</tr>
<tr>
<td class="bg_leftborder"> </td>
<td></td>
<td class="bg_rightborder"> </td>
</tr>
<tr class="newStyleOnly">
<td class="bg_bottomleft"> </td>
<td class="bg_bottomcenter"> </td>
<td class="bg_bottomright"> </td>
</tr>
</table><!-- .main_layout -->
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-1897727-23']);
_gaq.push(['_trackPageview']);
_gaq.push(['_gat._anonymizeIp']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(ga);
})();
</script>
<div id="world_selection_clicktrap" class="evt-world-selection-toggle">
</div>
<div id="world_selection_popup">
<div class="servers-list-top"></div>
<div id="servers-list-block">
</div>
<div class="servers-list-bottom"></div>
</div>
<div class="chat-open-buffer"></div>
<div id="bottom">
<div id="chat-wrapper">
</div>
<div id="footer">
<a href="#" id="unsupported-browser">
<img src="https://dstr.innogamescdn.com/8.44.1/28599/graphic/error.png" title="" alt="" class="" /> Desteklenmeyen tarayıcı
</a>
<div id="linkContainer">
<a href="#" class="world_button_active evt-world-selection-toggle">32. Dünya</a>
<a href="http://forum.klanlar.org/index.php" class="footer-link" target="_blank">Forum</a>
-
<a href="http://help.klanlar.org/wiki/Ana_sayfa" class="footer-link" target="_blank">Yardım</a>
-
<a href="http://blog.klanlar.org" class="footer-link" target="_blank">Blog</a>
-
<a href="/game.php?village=39143&screen=settings&mode=ticket" class="footer-link" target="_blank">Destek</a>
-
<a href="/game.php?village=39143&screen=settings&mode=ref&source=bottom_menu" class="footer-link">Oyuncu davet et</a>
-
<a href="/game.php?village=39143&screen=memo" class="footer-link">Not defteri</a>
-
<a href="/game.php?village=39143&screen=&action=logout&h=c86dc3bd" target="_top" class="footer-link">Çıkış</a>
</div>
</div>
</div>
<script>
$(document).ready(function() {
Timing.init(1457471156.4343);
TribalWars.initTab('1458e0d83d');
WorldSwitch.init();
WorldSwitch.worldsURL = '/game.php?village=39143&screen=api&ajax=world_switch&';
HotKeys.init();
Connection.connect('tr32.klanlar.org', 8082, 'cec5b6e92cde', true);
UI.Notification.enabled = true;
});