p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   .NET 4 and Visual Studio 2010 General Discussions (http://p2p.wrox.com/forumdisplay.php?f=579)
-   -   Visual Basic 2010 - Click a button on a website (http://p2p.wrox.com/showthread.php?t=88523)

jd29 September 28th, 2012 09:16 AM

Visual Basic 2010 - Click a button on a website
 
Code:

<a id="ctl00_ContentPlaceHolder_TabStrip_Tab3" href="javascript:__doPostBack('ctl00$ContentPlaceHolder$TabStrip','ctl00$ContentPlaceHolder$TabStrip$Tab3')" style="z-index: 8;">
<span class="wrap">
<span class="innerWrap">Network</span>

can anyone assist? I'm trying to click the button above.

Thank you

Ian Ryder September 28th, 2012 10:03 AM

Hi,

I am probably not the one to answer your question in full but to begin with let me give you some advice so the professionals of this forum may respond:-

1) Your post makes no sense. When you say "click button above" I assume you mean the Link above since I cannot see any button here and you have used an <a>etc</a> structure. Even this structure is incorrect since you are missing the closing </a> tag.

2) I also notice that you have not correctly closed off other tags and therefore you are going to get multiple errors anyway.

3) Overall the biggest issue with your post is that you have not explained what the issue is that you are having. You have said that "I'm trying to click the button above" but what does that mean? Do you want to make a cup of tea? Do you want to display some data? what?

It seems that you are trying to run some JScript from this link (this is where I am not qualified to help you) but you have to explain this in full for someone to help you further.

Good luck,

Ian

jd29 September 28th, 2012 10:21 AM

i'm creating an application that will automatically launch a website and click a button on that website.

Also here's more of the code.

Code:

div class="levelwrap level1" style="display: block;">
<ul>
<li class="first">
<li>
<li>
<a id="ctl00_ContentPlaceHolder_TabStrip_Tab3" href="javascript:__doPostBack('ctl00$ContentPlaceHolder$TabStrip','ctl00$ContentPlaceHolder$TabStrip$Tab3')" style="z-index: 8;">
<span class="wrap">
<span class="innerWrap">Network</span>

screens a screeshot of the button on the website and the code.


http://i48.tinypic.com/2ue2mo2.jpg

http://i49.tinypic.com/euonex.png

Imar September 28th, 2012 11:45 AM

It's still pretty unclear what you're trying to accomplish. For example, what do you mean with:

Quote:

an application that will automatically launch a website
Are you trying to open another web site from your application (which I assume is also a web application)? If so, a simple href would do the trick:

<a href=http://othersite.com/" target="_blank">Open other site</a>

If the newly opened window is on a different domain, you cannot use JavaScript to simulate a click on that site; that would be a major security risk.

Cheers,

Imar

jd29 September 28th, 2012 01:47 PM

ok...

I have an application called FM Audit which tracks meter readings off of printers. The installation is very simple and launches a localhost page after the installation. On this page it requires you to goto a network sub page and enter an ip range. I would like to automate this process because of how simple it is.

Ive managed to have my app open the .exe, install the .exe, open the page but i cannot get my vb app to click on network "button"

If i can get my vb app to click this button, this will save a great amount of time.

Imar September 28th, 2012 02:44 PM

I don't think that'll work due to browser security restrictions.

What you could do is emulate the postback by executing an HTTP request to the site from your VB.NET application. You can execute a POST request and send in the required data.

Cheers,

Imar

jd29 September 28th, 2012 03:06 PM

Thank you Imar but i am not that yet advanced to figure out how to do that. I am scheduled for a class labeled "Programming in Visual Basic with Microsoft Visual Studio 2010" next month.

Hopefully in the future i will reach that level. Any recommendations by the way?

Imar September 28th, 2012 03:27 PM

Google for "execute post request .net" and the first page with results shows you a number of good and easy to follow examples, such as this one: http://www.clevercomponents.com/arti.../httppost2.asp

Cheers,

Imar


All times are GMT -4. The time now is 09:17 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.