473,394 Members | 1,785 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

WebBrowser and clicking the button

There is a button on a website that I would like to click, using code.
This could apply to any website and any sort of button, whose name is
known.

As an example:
1) Navigate to www.google.com.
2) Use the following code:

private void MyButton_Click(object sender, EventArgs e)
{
HtmlElementCollection _collection =
webBrowser1.Document.All.GetElementsByName("btnG") ;

foreach (HtmlElement _elem in _collection)
{
// Do something with the element...
}
}

It so happens - there is only one element with the name "btnG" on
google.com. It is the "Google Search"-button (which performs a submit
action). How do I click it (let's say within the foreach-block or
anywhere else for that matter) or in any way invoke a click-type event
for it?

(The button in question could actually do anything - not necessarily
act as a submit-button)

....and, finally: Am I doing this the "wrong" way (using HtmlElement and
such)? How would you do it?

Thanks for taking the time to read this ;)

Jan 11 '06 #1
1 908
Matko,

Forget it, there are so many ways a button can be made an activated on a
webpage, that even if you have the proper code it would fail for most.

Just my thought,

Cor
Jan 11 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Matt | last post by:
Hi group, Here's a problem I've been trying to solve for the past several weeks. I have the standard WebBrowser object added to a form so it can access websites, and I have it load a default...
2
by: Matthias Huening | last post by:
Hi, os.startfile('http://www.python.org') works fine on WinXP with IE as default webbrowser. With Mozilla Firefox 0.9 as default webbrowser, however, I get an error. Firefox starts, the page...
0
by: Debbie | last post by:
I have a webbrowser on a form with a mshtml document. Ive added toolbar buttons for setting bold etc and this all works. The problem is the extra buttons i added. Just standard buttons. But...
0
by: Don Tucker | last post by:
I am attempting to load a web page and display its HTML contents into a text box on a Windows Application Form using the WebBrowser control in Visual Studio 2005. On my form, I have a button, and...
2
by: atn2002 | last post by:
With WebBrowser control in .NET 2.0, in DesignMode, when I double click a word to select it and then try to type, it won't let me, until I press Delete or Backspace and manually click on the page...
3
by: cweeks | last post by:
I use the InvokeMember("Click") method of HtmlElement to click a button in a web page using the Webbrowser control that is new in VS 2005 C# Express. Now I need to be able to select a member of a...
7
by: Dave Booker | last post by:
I am using a WebBrowser object in my .NET 2.0 application, but it is not shown to the user. Every time a timer event triggers it to perform a m_WebBrowser.Navigate() I get that classic IE 'click'...
1
by: L. Chernov | last post by:
Hello, I am trying to work with .Net 2005 WebBrowser object, and put it on a "Windows control library" (embedded in a user control class) and then I am executing it from an ASP.Net webform(with...
0
by: SirPoonga | last post by:
I am not liking the default behavior the treeview with right clicking. I have a treeview with a context menu assigned to it. When I hold the right mouse button on a node the node is highlighted. ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
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,...
0
jinu1996
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...
0
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...
0
tracyyun
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...

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.