简体   繁体   中英

How do I access the userid and password of a page using HTML Agility Pack?

I'm trying to get started with HtmlAgilityPack and was wondering if someone could help me get off to a good start.

I'm trying to access the user1 id and the password1 id from the url https://www.foragentsonly.com/login.aspx

How would I go about that?

Given that you have the HTML document already, this should work:

HtmlDocument doc = new HtmlDocument();
doc.Load("file.htm");
doc.DocumentElement.SelectNodes("//input[@id=user1]");
doc.DocumentElement.SelectNodes("//input[@id=password1]");

It just works off standard xpath syntax, so for more complex queries, use this reference as a guide.

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