简体   繁体   中英

How to invoke a click method on an html page which has no id/name but a class name in c#?

I am writing an automation for web site. I am using the HTMLelement in the MSHtml package.Using this object I can only get elemnts by tag names/id's but not by Class name.

The above tag is a button. I waould like to invoke a click method on it.

Please help......

I am assuming that you are using IHTMLElement interface, with which you can iterate over the document and check the className member, collecting those that match.

If you are using 3.5, this sounds like a good place for Linq + an extension method.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM