Howto search within a Site with HTMLAgilityPack with changing search URLSAsk Question


i am building a project to search for a specific driver at Lenovo Website ( This site changes the search URL while typing, if a suitable product category is found.

This means for example if you search for "ideapad" it uses:

if you search for "T540p 20BE" the Url changes to:

First i tried to use the url above[Searchpattern]. you get back a Json File which has further information to all modeltypes of that devices. Not the response i needed.

What i need is a way to get back all available drivers for some given Modell. As Response to the search you get a Html Document, which contains all drivers in an embedded html page:

Lenovo Driver Page !]

I have tried different approches with selenium which works, but need a usabel way for my application. I tried with HTMLAgilityPack and xpath, but came not across the problem with changing search urls?

How can i get the Version and the Downloadlink ??

Update: Here is some example code. After not being able to get the correct syntax of the get Statemente, i tried to input the searchtext within the inputbox.

  1. Goal: Be able to paste searchtext into the inputbox within the lenovo site, or overcome the changing urls (as mentioned above).

  2. Extract the needed informations from the resulting driverpage

Edit: Just delete the unneeded code part. Can someone give me a hint for a working approach on this. If HtmlWeb is not the best solution, what would you prefer ?


You need to query for the corresponding elements and get the values you need. For example for version you need to query for the version DOM element (with tag, css class or any other attribute) and get the InnerText property. For the download links you need to query for the download element and get the href attribute.

If you have any problems during the development, add the code to the question to let us understand what you are doing and for what you are querying.

Edit: About the url search part. First of all, you need to understand that your HtmlDocument is not a browser and you cannot search products by filling the textbox in the site. You need to find other way to find the corresponding url for the inserted product. One option can be to get data from all available search urls, combine that data, and search inside of that combined one.

标签: .net search xpath html-agility-pack
© 2014 TuiCode, Inc.