[HOW TO]Webbrowser shows only CAPTCHA
If you need help with a project or need to know how to do something specific in VB.NET then please ask your questions in here.
Forum rules
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
6 posts
Page 1 of 1
Hi again !
Could you say me the code to make my webbrowser shows only a CAPTCHA image ? The website that have the CAPTCHA image also have another things, but I want it only show the CAPTCHA image...
Thanks in Advance!

Could you say me the code to make my webbrowser shows only a CAPTCHA image ? The website that have the CAPTCHA image also have another things, but I want it only show the CAPTCHA image...
Thanks in Advance!
Can you give an example of the page that you are trying to take this from?
mandai wrote:Can you give an example of the page that you are trying to take this from?Yes, here it is a source code:
Code: Select all
Copy this html to a notepad, save as .htm (all files) and open it. You will see a captcha image...<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" id="min-width" lang="pt" xml:lang="pt" ><head><title> - Patrick Costa</title><meta http-equiv="content-type" content="text/html; charset=utf-8" /><meta http-equiv="content-script-type" content="text/javascript" /><meta http-equiv="content-style-type" content="text/css" /><meta name="robots" content="noindex, follow" /><meta name="title" content=" - Patrick Costa" /><link rel="stylesheet" href="http://patrickcosta.forumeiros.com/0-ltr.css" type="text/css" /><link rel="search" type="application/opensearchdescription+xml" href="http://patrickcosta.forumeiros.com/improvedsearch.xml" title="Patrick Costa" /><link rel="search" type="application/opensearchdescription+xml" href="http://www.directorioforuns.com/pt/search/improvedsearch.xml" title="Pesquisar fóruns" /><script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js" type="text/javascript"></script><script src="http://illiweb.com/rsc/34/frm/lang/pt.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
$(document).ready(function(){});//]]></script><script type="text/javascript">//<![CDATA[
var _gaq = _gaq || [];_gaq.push(["_setAccount", "UA-6105650-10"]);_gaq.push(["_trackPageview"]);_gaq.push(['_trackPageLoadTime']);(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";var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(ga, s);})();//]]></script></head><body><a id="top" name="top" accesskey="t"></a><div class="minwidth_IE"><div class="layout_IE"><div class="container_IE"><div class="pun"><div id="pun-intro" class="clearfix"><a href="http://patrickcosta.forumeiros.com/" id="pun-logo"><img src="http://illiweb.com/fa/invision/pt/logo.png" alt="Patrick Costa" /></a><div id="pun-title">Patrick Costa</div><p id="pun-desc">Projectos</p></div><div id="pun-head"><div id="pun-navlinks"><ul class="clearfix"><li><a class="mainmenu" href="http://patrickcosta.forumeiros.com/" rel="nofollow"><img id="i_icon_mini_index" src="http://illiweb.com/fa/empty.gif" border="0" hspace="2" alt="Início" title="Início" />Início</a> </li><li><a class="mainmenu" href="http://patrickcosta.forumeiros.com/calendar" rel="nofollow"><img id="i_icon_mini_calendar" src="http://illiweb.com/fa/empty.gif" border="0" hspace="2" alt="Calendário" title="Calendário" />Calendário</a> </li><li><a class="mainmenu" href="http://patrickcosta.forumeiros.com/faq" rel="nofollow"><img id="i_icon_mini_faq" src="http://illiweb.com/fa/empty.gif" border="0" hspace="2" alt="FAQ" title="FAQ" />FAQ</a> </li><li><a class="mainmenu" href="http://patrickcosta.forumeiros.com/search" onclick="showhide(document.getElementById('search_menu')); return false;" rel="nofollow"><img id="i_icon_mini_search" src="http://illiweb.com/fa/empty.gif" border="0" hspace="2" alt="Buscar" title="Buscar" />Buscar</a> <script type="text/javascript">//<![CDATA[
var url_search = 'http://patrickcosta.forumeiros.com/search';
insert_search_menu_new();//]]>
</script></li><li><a class="mainmenu" href="http://patrickcosta.forumeiros.com/memberlist" rel="nofollow"><img id="i_icon_mini_members" src="http://illiweb.com/fa/empty.gif" border="0" hspace="2" alt="Membros" title="Membros" />Membros</a> </li><li><a class="mainmenu" href="http://patrickcosta.forumeiros.com/groups" rel="nofollow"><img id="i_icon_mini_groups" src="http://illiweb.com/fa/empty.gif" border="0" hspace="2" alt="Grupos" title="Grupos" />Grupos</a> </li><li><a class="mainmenu" href="http://patrickcosta.forumeiros.com/register" rel="nofollow"><img id="i_icon_mini_register" src="http://illiweb.com/fa/empty.gif" border="0" hspace="2" alt="Registrar-se" title="Registrar-se" />Registrar-se</a> </li><li><a class="mainmenu" href="http://patrickcosta.forumeiros.com/login" rel="nofollow"><img id="i_icon_mini_login" src="http://illiweb.com/fa/empty.gif" border="0" hspace="2" alt="Login" title="Login" />Login</a> </li></ul></div></div><div id="page-body"><div id="emptyidcc" class="no-left"><div id="outer-wrapper"><div id="wrapper"><div id="container"><div id="content"><div id="emptyidleft"></div><div id="main"><div id="main-content"><div class="vce96879" ><iframe frameborder="0" marginwidth="0" marginheight="0" scrolling="no" width="728" height="90" src="http://ad.z5x.net/st?ad_type=iframe&ad_size=728x90§ion=1649932"></iframe><br class="clear" /></div><div style="clear:both;"></div><style type="text/css">html body .vce96879,html body .vce96879 iframe,html body iframe[name="google_ads_frame"],html body .vce96879 iframe[name="google_ads_frame"],html body #wrap #page-body div.vce96879,html body #page-body .vce96879{display:block!important;visibility:visible!important;float:none!important;position:inherit!important;left:inherit!important;top:inherit!important;right:inherit!important;bottom:inherit!important;margin:0 auto!important;padding:inherit!important;filter:alpha(opacity=100)!important;-moz-opacity:1!important;-khtml-opacity:1!important;opacity:1!important;z-index:9999!important;text-align:center!important}html body .vce96879,html body .vce96879 iframe[name="google_ads_frame"]{width:728px!important;height:90px!important;min-height:90px!important}html body .vce96879 iframe{border:0px!important}html body iframe[name="google_ads_frame"]{width:100%!important;height:inherit!important;min-height:inherit!important}</style><div style="height:3px"></div><div class="main"><form action="" method="post" class="frm-form" name="form_confirm" id="form_confirm"><div class="main-head"><h1 class="page-title">Cadastrar-se no fórum</h1></div><div class="main-content"><fieldset class="frm-set"><dl><dt><label>Confirmar senha :*</label></dt><dd><input class="inputbox narrow" type="password" name="password_confirm" maxlength="25" /></dd></dl><dl><dt><label>Código de confirmação : *</label></dt><dd class="captcha"><div class="captcha-img left"><label for="reg_key" dir="ltr"><img src="http://patrickcosta.forumeiros.com/antirobot_pic.forum?a=5b37465bb6f03c9b365483904222be75" alt="" /></label><input type="hidden" name="username" value="" /> <input type="hidden" name="time" value="" /></div><input class="inputbox tiny" type="text" name="reg_key" id="reg_key" maxlength="5" dir="ltr" /></dd></dl><dl class="frm-buttons"><dt> </dt><dd><input type="hidden" name="auth[]" value="16b1e58a2f0449c6875cfa36ddf5d910" /><input type="hidden" name="auth[]" value="52a98d395b020bb732617f2e905adf7e" /><input type="hidden" name="username" value="patrickcosta" /><input type="hidden" name="email" value="patrick_69@live.com.pt" /><input type="hidden" name="password" value="assinatura" /><input type="hidden" name="confirm_pass" value="e4375e6e10666b665104dfb4329b33b6" /><input type="submit" name="submit" id="submit" value="Salvar" /> <input type="reset" name="reset" value="Reiniciar" /></dd></dl></fieldset></div></form></div><script type="text/javascript">//<![CDATA[
document.forms['form_confirm'].elements['password_confirm'].focus();//]]></script></div></div></div></div></div><div id="emptyidright"></div></div></div></div><div id="pun-foot"><div id="pun-about" class="clearfix"><form action="http://patrickcosta.forumeiros.com/viewforum" method="get" name="jumpbox" onsubmit="if(document.jumpbox.f.value == -1){return false;}" id="qjump"><fieldset><p><label>Ir para: </label></p><select name="selected_id" onchange="if(this.options[this.selectedIndex].value != -1){ forms['jumpbox'].submit() }"><option value="-1">Selecionar um fórum</option><option value="-1"></option><option value="-1">|</option><option correctif="foro" value="c1">|--Sua primeira categoria</option><option correctif="foro" value="f1"> |--Seu primeiro fórum</option></select><input type="hidden" name="tid" value="caf18a5c6bfb5cb0e9800998ecf8427e" /> <input type="submit" value="Ir" /></fieldset></form><ul><li><strong><a href="http://www.forumeiros.com/" target="_blank">Fórum grátis</a></strong> | <span class="gensmall">©</span> <a href="http://www.forumeiros.com/pt/punbb/" target="_blank">PunBB</a> | <a name="bottom" href="http://ajuda.forumeiros.com/" target="_blank">Fórum grátis de ajuda</a> | <a name="bottom" href="http://patrickcosta.forumeiros.com/contact" rel="nofollow">Fale conosco</a> | <a href="http://patrickcosta.forumeiros.com/abuse?page=%2Fregister%3Fagreed%3Dtrue%26step%3D2&report=1" rel="nofollow">Assinalar uma queixa</a> | <strong><a href="http://www.forumeiros.com" target="_blank">Criar um fórum</a></strong></li></ul></div><br /><p class="center"><strong></strong></p></div></div></div></div></div><script type="text/javascript">//<![CDATA[
fa_endpage();//]]></script></body></html>
Thanks
When the page has finished loading:
Code: Select all
For Each el As HtmlElement In WebBrowser1.Document.All
If el.GetAttribute("class") = "captcha-img left" Then
WebBrowser1.Navigate(el.FirstChild.FirstChild.GetAttribute("src"))
Exit For
End If
Next
LMAOSHMSFOAIDMT
Laughing my a** of so hard my sombrero fell off and I dropped my taco lmao;
Over 30 projects with source code!
Please give reputation to helpful members!
![Image]()
![Image]()
Laughing my a** of so hard my sombrero fell off and I dropped my taco lmao;
Over 30 projects with source code!
Please give reputation to helpful members!

@MrAksel I added that in the DocumentComplete event and it didn't work.
This would be more reliable:
This would be more reliable:
Code: Select all
Private Sub WebBrowser1_DocumentCompleted(sender As System.Object, e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
Dim form As HtmlElement = WebBrowser1.Document.GetElementById("form_confirm")
If Not form Is Nothing Then
Dim imgs As HtmlElementCollection = form.GetElementsByTagName("img")
Dim src As String = imgs(0).GetAttribute("src")
WebBrowser1.Navigate(src)
End If
End Sub
mandai wrote:@MrAksel I added that in the DocumentComplete event and it didn't work.
This would be more reliable:Code: Select allPrivate Sub WebBrowser1_DocumentCompleted(sender As System.Object, e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted Dim form As HtmlElement = WebBrowser1.Document.GetElementById("form_confirm") If Not form Is Nothing Then Dim imgs As HtmlElementCollection = form.GetElementsByTagName("img") Dim src As String = imgs(0).GetAttribute("src") WebBrowser1.Navigate(src) End If End Sub
Thank you, its perfect ;)
6 posts
Page 1 of 1
Copyright Information
Copyright © Codenstuff.com 2020 - 2023