0

I am working on a C# Project with Visual Studio 2013.

My Problem: There is a website on which you can search something and it displays a few results (i.e 30 of 1200). So, at the bottom of this website is a button to show more 30 results.

I succeeded in reading the current 30 results (using the WebClient), but I have no idea how to find a solution to get ALL the results.

I know what to do, but I don't know how to do it. I have to click on the button until there are no hidden results anymore. After that I have to read out the html (with my existing code).

I searched on google for a few hours and found some things with "headless" browsers, and I also tried to use the "InvokeMember"-Method of the Webbrowser, but it doesn't work. I only get the 30 results if I print out the HTML.

I hope you understand my question. Please help me.

Thanks.

Patcher56
  • 193
  • 2
  • 12

2 Answers2

1

WebBrowserControl Scroll to Bottom

 private void webBrowser1_Navigated(object sender, WebBrowserNavigatedEventArgs e)
        {
            webBrowser1.Navigated += (s1, e1) =>
            {
                if (webBrowser1.Document.Body != null) webBrowser1.Document.Body.ScrollIntoView(false);
            };
        }

Or

if (theDoc.Body.InnerHtml != null)
                        {
                            try
                            {
                                webBrowser1.Document.Window.ScrollTo(0, webBrowser1.Document.Body.ScrollRectangle.Height);
                                timer2.Enabled = true;
                            }
                            catch { }
                        }
                        else
                        {
                            timer2.Enabled = true;
                        }
vijayvicks
  • 161
  • 10
-1

It looks like you need to implement pagination. Depending on your requirements, you might need server or client side. The link might help you decide: StackOverflow Client Side vs Server Side

Community
  • 1
  • 1
abhijain
  • 11
  • 3