Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 2005 > C# 2005
|
C# 2005 For discussion of Visual C# 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# 2005 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 17th, 2007, 06:31 PM
Authorized User
 
Join Date: Feb 2007
Posts: 28
Thanks: 0
Thanked 0 Times in 0 Posts
Default Need to Click Element in DOM document

How to Click Element in DOM document

Hi All,

I am working on a project that host WebBrowser control using C#. Objecive of this project to automate
webBrowser. I have the element that, I want to be click automatically. Please Help!!


//Browser name = LPBrowser

mshtml.IHTMLDocument3 doc = (mshtml.IHTMLDocument3)this.LPBrowser.Document.Dom Document;

doc.getElementById("newlink").click(); //This click() method doesn't work me


__________________
A.Asif
 
Old October 18th, 2007, 03:38 AM
samjudson's Avatar
Friend of Wrox
 
Join Date: Aug 2007
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
Default

The click event isn't a method, you can't call it - its used for hooking up events of your own to the click event.

Try using WebBrowser.Document.GetElementById, rather than going back into MSHTML land. This will keep you inside the managed code and give you much more help on understanding what everything is.

I think what you might need to do is to try to simulate the mouse click using PInvoke. The hard part is getting the position of the thing you want to click.

I haven't any time to investigate further, so good luck.

/- Sam Judson : Wrox Technical Editor -/





Similar Threads
Thread Thread Starter Forum Replies Last Post
HTML DOM - clone form element could not be aligned Shibu Javascript 5 November 15th, 2008 11:24 PM
How to Click Element in DOM document [email protected] C# 1 October 18th, 2007 03:03 AM
Click event in DOM document [email protected] C# 2005 0 October 18th, 2007 12:43 AM
Need help with onchange of DOM element johndubchak BOOK: Professional JavaScript for Web Developers ISBN: 978-0-7645-7908-0 2 March 20th, 2006 07:27 PM
How to .... Dom Document namitjung PHP How-To 4 July 7th, 2005 12:17 AM





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