1

I use the Mechanize for filling the form of filtering. My code:

br = Browser()
br.open(self.domain)
br.select_form(nr=1)
br.find_control("pf_keywords").value = "Lisp"
response = br.click(type='button', nr=0)
#or
response = br.submit(label='Применить фильтр')

At the same time, submit button is not in the list of controls for this form. Html code for this button:

<button type="button" class="b-button b-button_flat b-button_flat_green" onclick="$('frm').submit();">Применить фильтр</button>

Because of this, using the method click() and submit() impossible to produce form submission. In these methods, there is a search of the desired control with the parameters passed to the control environment forms, as desired button is not there, raise a bug :

mechanize._form.ControlNotFoundError: no control matching type 'button', kind 'clickable'

What should I do? How can push a button and get the result?

4
  • 1
    Not a button ! is Javascript . check this : stackoverflow.com/questions/1806238/… Commented Aug 23, 2015 at 10:06
  • OK, following the advice of the question that you have thrown off, I need to emulate that JavaScript does. He does submit this form; how it can be done on the Mechanize? Commented Aug 24, 2015 at 9:15
  • Need use selenium ! mechanize don't work on JavaScript buttons. Commented Aug 24, 2015 at 9:21
  • I still found the Splinter, maybe it will approach Commented Aug 24, 2015 at 9:32

0

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.