2

I would like to click on button "query"
my inspect element gives the following code for the button query and exit.

<TD class=font9 colSpan=4 align=center>&nbsp;&nbsp;int pageSize <INPUT class=bg0 size=3 value=10 name=pageSize> Article &nbsp;&nbsp; <!-- <input type="button" class="imagesButton" name="btnPrint" value="打 印" onclick="doPrint(gFormName);">-->&nbsp;&nbsp; <INPUT onclick=doFind(gFormName); class=imagesButton type=button value=query name=Submit> &nbsp;&nbsp; <!--     <input type="button" class="imagesButton4" name="Submit2" value="yesQuery">
                                  &nbsp;&nbsp; 
                               --><INPUT onclick=doExit() class=imagesButton type=button value=exit name=Submit5> &nbsp;&nbsp; </TD>

I tried the below code for the click

import mechanize
br = mechanize.Browser()
submit_response = br.submit(name='Submit',label= 'query')

while executing the code I faced an error

  File "C:\Python27\lib\site-packages\mechanize\_form.py", line 3185, in _find_control
raise ControlNotFoundError("no control matching "+description)
mechanize._form.ControlNotFoundError: no control matching name 'Submit', kind 'clickable', label 'query'

can any on help me how to click on button

1

1 Answer 1

3

the buttons trigger javascript functions ("doPrint(gFormName)",...)

on http://bytes.com/topic/python/answers/764326-using-mechanize-python-navigate-website is a similar problem. it was solved by triggering the javascript action of the button manually

br.form.action="button_action"

see also http://www.stackoverflow.com/questions/1806238/mechanize-python-click-a-button

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.