0

I am trying to upload information through a form using Python. I would share the form but it is password protected (I have permission to access it though). I have been using mechanize but have encountered a problem.

The page that I am uploading to actually consists of a number of forms, which are accessed by tabs at the top of the page. These tabs are set up using Javascript. When I access the URL of the page, I can see the form for the first tab using mechanize, but I do not know how to change tabs.

This is a snippet I got with Firebug:

<form id="frmEntityEdit" enctype="multipart/form-data" onsubmit="javascript:return
 WebForm_OnSubmit();" action="entityEditProducts.aspx?
EntityFilterID=239&EntityName=Category&iden=6751" method="post" name="frmEntityEdit">

Also, when I change tabs, value for "TabStrip1_SelectedNode" cycles through "p0", "p1", "p2", etc.

<input id="TabStrip1_Data" type="hidden" name="TabStrip1_Data">
<input id="TabStrip1_Properties" type="hidden" name="TabStrip1_Properties">
<input id="TabStrip1_SelectedNode" type="hidden" value="p0" name="TabStrip1_SelectedNode">
<input id="TabStrip1_ScrollData" type="hidden" value="0" name="TabStrip1_ScrollData">

I would like to be able to switch tabs, so that I can fill out all the forms.

Thanks in advance for the help. Let me know if you need more information.

1 Answer 1

1

mechanize doesn't evaluate javascript. The easiest way that I've seen to do it is by using Selenium, which will open a browser on your computer and communicate with python.

I answered a similar question here.

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.