pardon me if question title not expressive ,but want have simple tool should search in website , result 3 kinds of data (name,phone,address) had written codes opening website inside web browser tool , applied loop statement search 30 numbers , works problem works 1 time , second problem in retrieving data other page opens when search button clicked ,so suppose start sequential based number in search 737000000 should search number , opens other page contains data , put these data in 3 text boxes previous page , search 737000001 (adding 1 each time)
codes
private void searchbtn_click(object sender, eventargs e) { (int = 0; < 30; i++) { string temp = string.format("{0:d6}", i); string formula = textbox1.text + temp; // input elements htmlelementcollection inputs = webbrowser1.document.getelementsbytagname("input"); // select "txtsearch" input htmlelement input = inputs["q"]; if (input != null) { string value = input.getattribute("value"); if (!string.isnullorempty(value)) { // searched no results } else { // input search text string searchtext = formula; input.setattribute("value", searchtext); var elements = webbrowser1.document.getelementsbytagname("button"); foreach (htmlelement element in elements) { element.invokemember("click"); } } } }
the data in other page when view page source appears
<table class="table table-responsive table-striped"> <thead> <tr> <th>name</th> <th>number</th> <th>address</th> </tr> </thead> <tbody> <tr> <td><a href="http://yementel.info/737000000">mat adam</a></td> <td><a href="tel:737000000"><b class="text-success">737000000</b></a></td> <td>new york</td> </tr> </tbody> </table>
Comments
Post a Comment