以机械化形式选择未命名的文本字段(python) [英] Selecting an unnamed text field in a mechanize form (python)

查看:35
本文介绍了以机械化形式选择未命名的文本字段(python)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我正在制作一个程序,使用机械化和python将街道地址批量转换为gps坐标.这是我第一次使用机械化.我可以在页面上选择表单(form2").但是表单中的文本框没有名称.我如何选择文本框以便机械化可以输入我的文本?我试过通过它的 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

这里是网站的源代码.

<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>

任何帮助将不胜感激.

推荐答案

form.find_control(id="search") ?

这篇关于以机械化形式选择未命名的文本字段(python)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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