Hi


im just made a webbrowser on cisual studio 2008 to enter automaticly to a link but me i want the webbrowser to

enter to the link and wait 10 sec then click on Tab key then click on ENTER key Then ENTER

key again , then wait 10 sec and close the webbrowser automaticly

i want the clicks to be inside the webbrowser for exemple i open the webbrowser the open a auther program for exemple i open a calculator i dont want the clicks to be on the calculator but i want it to be on the webbrowser

Please help me asap and thanks in advance

Recommended Answers

All 12 Replies

Check out this thread about using SendKeys.
To pause in between the SendKeys, you can use:

Threading.Thread.Sleep(1000) '// 1000 is a second.

But if i use SendKeys like that

SendKeys("{TAB}")
SendKeys("{ENTER}")
SendKeys("{ENTER}")

the clicks is gonna be on the opened program if i open the browser and keep it and work on auther programs the click is gonna be on the auther program not in the webbrowser

from your post, i assume that you want to click a button that is located in a website you are accessing using the vb.net webbrowser control


use the timeout mentioned above, and try:

Me.webbrowser1.Document.Forms(0).InvokeMember("submit")

submit being the buttons name.


..

why do you want a webpage to do this, and not just put buttons on a form if i may ask?

------------


edit:
i reread and saw that you said link above.

Can you paste HTML source code from a webpage you are trying to use this for?
You might be able to accomplish this by not using SendKeys and just filling out values in certain TextBoxes, then press the Submit Button.

read that the best way to click a link inside the webbrowser control is by using javascript

WebBrowser1.Navigate("javascript:function%20x(){document.getElementById('foo').click()}x()")

then you would have to make changes to the page itself.

im interested to see what codeorder comes up with though

this is the source code of page

<html xmlns="http://www.w3.org/1999/xhtml" id="adfly_html">
<head>        
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 
    <title>adf.ly - shrink your URLs and get paid!</title>
    <meta name="title" content="" /> 
        
    <link rel="icon" href="http://adf.ly/favicon.ico" type="image/ico" />
    <link rel="shortcut icon" href="http://adf.ly/favicon.ico" />    
    <link rel="stylesheet" type="text/css" href="/css/adfly.css?v=1.1" />
    
    <script type="text/javascript" src="/js/compressed3.js?v=35"></script>       
    <script type="text/javascript">
    
    if (top != self) {
        try { top.location = self.location; }
        catch (err) { self.location = '/404.shtml'; }
    }      
        
    var log_token = 'b36a3b17cffa5d186ca3b94c084b968d';
    var log_hash = '376df308ab6d5533e77f6a2618e01c9c';
    var at = 1;
    var omnigy = 0;
    var countdown = 7;
    var playerVersion = swfobject.getFlashPlayerVersion();               
    
    function counter() {
        countdown = countdown-1;       
        
        if (countdown <= 5) {
            $('#countdown').html(countdown + ' seconds');
        }

        if (countdown == 0) {
            showSkip();        
            clearInterval(t);
            
            <!-- $.post("/tq/tq.php", { result: "2", flash1: playerVersion.major, flash2: playerVersion.minor } ); -->
            
        }         
    }   

    function setAd() {
        $('#rf').attr('src', '/market.php?cb=3m&t=b36a3b17cffa5d186ca3b94c084b968d');
    }

    function showSkip() {
        
        $('#skip_button').attr('href', 'http://sharecash.org/download.php?file=1628170'); 
        
        $('#skip_button').click(function(e) {

            $.post('/l.php', function(data) { 
                window.location = 'http://sharecash.org/download.php?file=1628170'; 
            });
            
            return false;
        });
                
        $('#please_wait').fadeOut(400, function () {$('.skip').fadeIn()});
    }
    
    $(document).ready(function() {    
        $('#wait').css('display', 'block');
        t = setInterval("counter()",1000);   
        $('#Interstitual').fadeIn(1000, setAd());
        $('#overly').css('display', 'none');        
    });    
    
    </script>  
    

</head>

<body id='home'>

<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-6469700-9']);
_gaq.push(['_setCustomVar', 1, 'User', '94114', 3]);
_gaq.push(['_trackPageview']);


  (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='overly' style='background-color: #317EC5;'>
    <div style="text-align:center; margin-top: 100px;">
        <a href="http://adf.ly/?id=94114" target="_blank">
            <img src='http://adf.ly/images/logo_fb.png' border='0' alt='logo' style='display:none;' />
            <img src='http://adf.ly/images/logo.png' border='0' alt='logo' />
        </a>

        
        <div id="wait" style="display:none;"><p>PLEASE WAIT..</p></div>
        
        <input type="hidden" id="adfly_id" name="adfly_id" value="94114">

        <noscript>
            <div style="text-align:left; font-family: arial; font-size: 14px; margin:20px auto; width:580px; height: 211px; background-image: url(/images/no_javascript.png);">
            <div style="margin-bottom: 10px; padding-left:30px; padding-top: 75px;">To be able to view this link, please enable JavaScript in your Internet browser.</div>
            <div style="margin-bottom: 10px; padding-left:30px;">Please click on one of the following links for instructions on how to do this.</div>
            <div style="margin-bottom: 10px;padding-left:30px; "><a href="http://support.microsoft.com/gp/howtoscript" target="_blank">Internet Explorer</a>, <a href="http://support.mozilla.com/en-US/kb/JavaScript" target="_blank">Firefox</a>, <a href="http://www.google.com/support/forum/p/Chrome/thread?tid=3599758a8b1907ec&hl=en" target="_blank">Google Chrome</a>, <a href="http://mistered.us/tips/javascript/opera.shtml" target="_blank">Opera</a></div>
            <div style="padding-left:30px;">You also need Adobe Flash Player installed, this can be downloaded from <a href="http://get.adobe.com/flashplayer/" target="_blank">here</a>.</div>
            </div>
        </noscript>
    </div>
</div>


<div id="Interstitual" style="display:none; background-color: #FFFFFF; display: none; z-index:9999; position: absolute; width: 100%; height: 100%;">
    <table cellpadding="0" cellspacing="0" height="100%" width="100%">

      <tr height="1%">
        <td style="top:0;width:100%">
            <div id="sitebar">

                <div id="top">
                    <span style="float: left; padding-left: 20px; padding-top: 7px;">
                        <span style="font-family: verdana; font-size: 28px; color: #fff;">Adf.ly</span>
                    </span>

                    <span style="float: right; padding-right: 20px; padding-top: 9px;">
                        <div style="position:absolute; width: 130px; height: 30px; top: 10px; right:0px; width: 150px; color:#ffffff; font-weight: bold; font-size: 16px;" class="please_wait" id="please_wait">
                        Please wait..<br />
                        <span id="countdown">&nbsp;</span>
                        </div>
                        <a id="skip_button" style="cursor:pointer;" class="skip" target="_top"><img src="/images/skip_ad_button.png" alt="Skip Ad" width="155" height="39" id="skip_ad_button" onmouseover="document.getElementById('skip_ad_button').src = '/images/skip_ad_button2.png';" onmouseout="document.getElementById('skip_ad_button').src = '/images/skip_ad_button.png';" /></a>
                    </span>
        
                </div>

                <div id="bottom">
                    <span style="float: left; padding-left: 20px;">
                        <a href="http://adf.ly/?id=94114" target="_blank">adf.ly</a> shorten urls and earn money
                    </span>
                    <span style="float: right; padding-right: 20px;">
                        <a href="http://adf.ly/advertising.php" target="_blank">Your Site Here: 10,000/visits $5.00</a>
                    </span>
                </div>

                
            </div>
        </td>
      </tr>

      <tr>
        <td>
            <iframe scrolling="auto" id="rf" frameborder="0" allowtransparency="true" style="width:100%;height:100%"></iframe>      
        </td>
      </tr>

    </table>    
</div>
    
</body>
</html>

i want click automaticly on SKIP AD

i need click with mouse

See if this helps.
1 WebBrowser(navigating to your webpage with the adf.ly AD)

Public Class Form1

    Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
        '// Since the link you need to skip the AD is located in the <head> section of the webpage, you need to only get that source code.
        Dim sAD_page As String = WebBrowser1.Document.GetElementsByTagName("head").Item(0).InnerHtml '// get <head> HTML content.
        If sAD_page.Contains("function showSkip") Then '// check content for the "showSkip" JavaScript Function.
            skipAd(sAD_page, WebBrowser1) '// send source code and which WebBrowser used to skip the AD.
        End If
    End Sub

    Private Sub skipAd(ByVal htmlSourceCode As String, ByVal selectedWebBrowser As WebBrowser)
        With htmlSourceCode '// shorten code.
            Dim iIndex As Integer = .IndexOf("function showSkip") '// locate the JavaScript Function.
            iIndex = .IndexOf("http:", iIndex) '// locate the URL in the Function.
            htmlSourceCode = .Substring(iIndex, .IndexOf("'", iIndex) - iIndex) '// extract only URL.
            selectedWebBrowser.Navigate(htmlSourceCode) '// Navigate to extracted Link from the JavaScript Function of "function showSkip".
        End With
    End Sub
End Class

Give the webpage a few seconds to navigate to your Skip Ad Button URL.

Is there any think to do to make thhis click like a click with mouse because on there terms hthey accept only clicks from mouse

and this is the rule

# The only legitimate way to open an adf.ly is with a mouse click, on the actual link.

can u please resolve this problem ??

I only helped because I thought this was to block ADs mostly for personal use, not to get rich doing it. I will not support such. How's that for "legitimate".

commented: + +0

im waiting u

please help me asap

why bro its legit

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.