I was trying to use a WebBrowser to scrape this website and tried to programmatically change the amount of displayed pages to 200. If you manually change the value of the drop down menu, it will refresh the results to show whatever amount of results you select, but if you do it with injected JavaScript (since the WebBrowser allows injecting JavaScript code into your local copy of the page), the value will change but the page will not refresh.
I also tried firing the onchange event by using menu.onchange() and menu.fireEvent("onchange") (where menu is the select element), but nothing happened. Then I just went through every event (at least that’s what I think) in the select element by doing a for..in loop and displaying every item that starts with on... this way:
for(var i in menu)
{
if(("" + i).indexOf("on") == 0) alert("" + i + " => " + menu[i])
}
And I noticed every single event was null. How is it possible for the page to know I’m changing the value if every event is null?
I did find a workaround and did it another way, and probably using a WebBrowser is not the best way to scrape this site. But I’m really curious about the above and not looking for a solution on how to scrape this site anymore.
The page uses jQuery to bind a
changeevent handler to the element. Thechangeevent handler submits the parent form. The following can be found inmain.js, lines 268-272:Binding an event handler this way will not cause a property to be changed on the element itself, which is why nothing showed up when you looked at the
on...properties.