Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
|
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# 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:29 PM
Authorized User
 
Join Date: Feb 2007
Posts: 28
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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:03 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

You can usually only click programmatically if the element has an onclick handler.
The only thing I can think of is to test if there's an onclick attribute defined and if not then use one of the navigate methods to follow the href, you'd have to pay attention to any target attributes too. It depends on whether this is a specific link or you want a general solution, if the former it's not too bad, if the latter then it is difficult.

--

Joe (Microsoft MVP - XML)





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
Need to Click Element in DOM document [email protected] C# 2005 1 October 18th, 2007 03:38 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.