D
D
dyrtage62020-01-02 23:21:14
Parsing
dyrtage6, 2020-01-02 23:21:14

How to work with a page in HtmlAgilityPack?

Let's say you need to use the search on the site and find in it what the user asked for. How do I enter text into this field and hit the search button on HtmlAgilityPack (using C# here)?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vasily Bannikov, 2020-01-03
@vabka

HtmlAgilityPack can only parse HTML.
If you need to click on a button on the page, then you need to use selenium
An alternative is to find what happens when you click this button and repeat

N
NonameProgrammer, 2020-01-02
@NonameProgrammer

var page = await (await client.GetAsync(url)).Content.ReadAsStringAsync();
var document = new HttpDocument();
document.LoadHtml(page);
var node = document.DocumentNode.SelectSingleNode(//xpath for search string);
And it won't help at all. Either Selenium or get requests.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question