3

I've been searching Google for almost every query I can think of related to this. The page I'm trying to submit is something similar to this. There is no form. The objects are not grouped in a form. Most other threads talk about the form not having a name, but in my case, the page doesn't have a form at all.

<div class="container"> 
    <br/>
    <img id="imageXYZ" />
    <br/>
    <input id="inputXYZ" />
    <br/>
    <button id="submitObject">Go</button>
    <br/>
    <script type="text/javascript">blah blah blah</script>
</div> 

So when there is no form, simply just an input field and button, how do I select a form so I can fill in the text box and click the button?

Thank-you so much!

1
  • 1
    If you found the solution to your original question you should answer it using the answer form instead if updating the question. Just a kind notice. Commented Dec 25, 2013 at 23:27

1 Answer 1

5

To do this, I had to do 2 things to get this to work with the code above. First, I had to use this line of code to select all the objects without a form.

Br.form = Br.global_form()

Secondly, the HTML code is formatted wrong, so I had to add a parameter to my initial browser call:

Br = mechanize.Browser(factory=mechanize.RobustFactory())
Sign up to request clarification or add additional context in comments.

1 Comment

Thank you for sharing. Your answer helped me as well.

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.