python - How to use mechanize to fill search form and get results back? -
I am trying to use mechanisms with dragon to search keywords using a search form. This is the form code:
& lt; Form id = "searchform" action = "http://www.example.com/" method = "get" & gt; & Lt; Input id = "s" type = "text" onfocus = "if (this.value == 'search') {this.value = '';}" onblur = "if (this.value == '') {This .value = 'Search';} "name =" s "value =" search "& gt; & Lt; Input type = "picture" style = "border: 0; vertical-alignment: top;" Src = "http://www.example.com/wp-content/themes/SimpleColor/images/search.gif" & gt; & Lt; / Form & gt; I want to present and get results so that I can remove information from the results.
Thanks in advance.
From
, you can create a browser object by br = mechanize.Browser () And follow a link with the object - br.open ("http://www.example.com/") , and then you select one Name = "searchform") by form br.select_form () and you can pass input by br <"s =" #something and assign it to resp = Br.submit () resp Use the kind of object you like.
Comments
Post a Comment