473,895 Members | 3,051 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Auto-Login on a WebBrowser?

1 New Member
I'm trying to create a program to automatically log me in to Myspace. Yes, I am too lazy to login myself!

And sorry, but I'm not exactly using a WebBrowser, but something that's name is "SHDocVw" that I got by adding a reference to something for my project... And I have also added a reference to "Microsoft HTML Object Library".

I wrote the following code to edit the text in the "username" box on the Myspace home page.

Expand|Select|Wrap|Line Numbers
  1. Private Sub SetTextboxText(ByVal Text As String)
  2.         DirectCast(GetCurrentWebForm.item("namehere"), mshtml.HTMLInputElement).value = "myemail"
  3.     End Sub
Then I wrote the following code, this time using a new project with a WebBrowser, to provide the names of the elements I would need to use from the Myspace home page.

Expand|Select|Wrap|Line Numbers
  1. Dim hdoc As HtmlDocument = Me.WebBrowser1.Document
  2.         Dim elemcoll As HtmlElementCollection = hdoc.GetElementsByTagName("input")
  3.         For Each helement As HtmlElement In elemcoll
  4.         If Not helement.GetAttribute("Type") = "hidden" Then
  5.         Me.TextBox1.Text = TextBox1.Text & Environment.NewLine & helement.Name
  6.         End If
  7.         Next
It provided the names of the username and password box that I would need to fill out.

So I modified the first code to fill the Username box with my email, but when I tested it out, the project became unresponsive for a couple seconds and then came with an error that "vshost.exe has encountered an error and needs to close....blah blah blah".

Can anyone help me out with this problem? I have been stumped on it for many days!!! If you can also help me figure out how to click the "Login" button on the homepage that would be helpful too! I'm using Visual Basic 2005 & Visual Basic 2008.

Personally, I believe that the problem is that the login form on the Myspace homepage may not be composed of a typical textbox or button. I think this because I tried my code out on the Google Homepage (to enter text and click "Search" button) and it worked like a charm. Or perhaps I need to provide an index in the code? Any help?

Oh, and I am using a computer running Windows XP.

Here is some more source code from my project to help explain some of the above:

Expand|Select|Wrap|Line Numbers
  1. Private Function GetCurrentWebDoc() As mshtml.HTMLDocument
  2.         Try
  3.             Return DirectCast(wb.Document, mshtml.HTMLDocument)
  4.         Catch ex As Exception
  5.             Return Nothing
  6.         End Try
  7.     End Function
Expand|Select|Wrap|Line Numbers
  1.     Private Function GetCurrentWebForm() As mshtml.HTMLFormElement
  2.         Try
  3.             If GetCurrentWebDoc.forms.length > 0 Then
  4.                 Return DirectCast(GetCurrentWebDoc.forms.item(0), mshtml.HTMLFormElement)
  5.             Else
  6.                 Return Nothing
  7.             End If
  8.         Catch ex As Exception
  9.             Return Nothing
  10.         End Try
  11.     End Function
Jun 24 '08 #1
0 1873

Sign in to post your reply or Sign up for a free account.

Similar topics

by: Manlio Perillo | last post by:
Hi. This post follows "does python have useless destructors". I'm not an expert, so I hope what I will write is meaningfull and clear. Actually in Python there is no possibility to write code that follows C++ RAII pattern. Of course Python objects are not statics like in C++, but in C++ the auto_ptr class is used for enforcing this pattern for dynamical
by: Glabbeek | last post by:
I'm changing the layout of my site. Instead of using tables, I will use DIVs. It's working fine, except for 1 thing: In IE6 some DIVs are not the correct width. Mozilla and Opera are showing the page the way I want. Does anybody know a solution for this? First of all, the code I am using: CSS ------- body {
by: Robert Downes | last post by:
I'm using the following in a page that I'm testing in Mozilla: p.actionLinkBlock {border: 1px #000000 dashed; padding: 0.2cm; width: auto} But the dashed border is extending to the right-edge of the screen. I want it to only extend as far as it needs to to nicely contain the content within (a couple of links). Is width: auto the wrong property to do this? Is Mozilla rendering the style wrong?
by: Vijay Kumar R. Zanvar | last post by:
Hello, Unlike register, auto keyword can not be used to declare formal parameter(s). Is there any specific reason for this? Kind regards, Vijay Kumar R. Zanvar
by: Alpha | last post by:
I retrieve a table with only 2 columns. One is a auto-generated primary key column and the 2nd is a string. When I add a new row to the dataset to be updated back to the database. What should I do with the 1st column ? (Below I have a "1" in place for now). Also, Does the datase.AcceptChanges(); updates the changes to the database? Which command do I use to update the changes in dataset back to the Access database table? Thanks, Alpha...
by: Samuel | last post by:
Hi, I am running into a problem of mixing UICulture = auto and allowing users to select culture using a dropdown list. I am detecting a querystring, "setlang", and when found, setting the CurrentUICulture to what's specified in the querystring. Since I want to allow UICulture auto detecting, I add UICulture = "auto" to page directive on each page.
by: maya | last post by:
at work they decided to center divs thus: body {text-align:center} #content {width: 612px; text-align:left; margin: 0 auto 0 auto; } this works fine in IE & FF, EXCEPT in FF it doesn't work if I change 'auto' to 0 for left and right margin values; I have to leave those at 'auto'.. so I would like to know what exactly means 'auto' -- what value it represents exactly (and does it apply for all elements/values you might apply 'auto' to?)
by: nospam_news | last post by:
I currently get asked about my usage of "auto". What is it for? The keyword is clearly superflous here. In contrast to the huge majority of C/C++ developers I write definitions very explicitly like that: int main(char argc, char *argv, char *env) { try { auto Exception mainException(1); mainException.setErrNo(42);
by: Piotr K | last post by:
Hi, I've encountered a strange problem with Firefox which I don't have any idea how to resolve. To the point: I've <divelement with a style "height: auto" and I want to retrieve this value ("auto") in JavaScript - however instead of getting "auto" value, I get calculated height. In IE and Opera it simply returns "auto". Any ideas how to check in Firefox if element height was set to "auto" ? I'll be grateful for any help.
by: JOYCE | last post by:
Look the subject,that's my problem! I hope someone can help me, thanks
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.