在机械化的形式选择一个不愿透露姓名的文本字段(蟒蛇) [英] Selecting an unnamed text field in a mechanize form (python)

查看:116
本文介绍了在机械化的形式选择一个不愿透露姓名的文本字段(蟒蛇)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我做节目批量转换街道地址,使用机械化和python GPS坐标。这是采用机械化我的第一次。我可以在页面上选择的形式(窗口2),但在形式的文本框中没有名字。我如何选择文本框,使机械化可以进入我的文字?我试着通过ID选择它。但这是行不通的。

So i'm making a program to batch convert street addresses to gps co-ordinates using mechanize and python. this is my first time using mechanize. I can select the form ("form2') on the page. however the text box in the form has no name. how do i select the textbox so that mechanize can enter my text? I've tried selecting it by its id. but that does not work.

br.select_form("Form2") #works as far as i know
br.form["search"] = ["1 lakewood drive, christchurch"] #this is the field that i cannot select

和这里是从网站源$ C ​​$ C。

and here is the source code from the website.

<form name="Form2" >
or  Type an <b>Address</b>
<input id="search" size="40" type="text" value=""  >
<input type="button" onClick="EnteredAddress();" value="Enter" />
</form>

任何帮助将非常AP preciated。

any help would be much appreciated.

推荐答案

form.find_control(ID =搜索)

这篇关于在机械化的形式选择一个不愿透露姓名的文本字段(蟒蛇)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆