0

I need to fill an online form which has button running java-script in the background, I have successfully filled data in all the available fields using python mechanize module.

I have read that I can use spidermonkey to get such a task done. On clicking on the button named "browse", a window pop's up and a file that is stored on the server is selected and the Id of the file is returned to the original web-page.Th following are the HTML and javascript for the page:

https://drive.google.com/file/d/0B5veiNJUXUAWWXdvRVY2cWcxbWc/edit?usp=sharing

Can you please suggest me a way to perform this ask as I am not acquainted with web-scraping and have no idea of which module to use to emulate the things the javascript is doing in python.

1 Answer 1

2

According to mechanize's docs, it does not interact or deal with JavaScript in any way. I learned this the hard way, and I ended up using headless Selenium, which is effectively browser automation without any visual component.

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

1 Comment

I have also resorted to use Selenium but I feel its not an elegant solution as it makes the code less flexible. Is there any other module to take care of such cases? I have also tried to emulate the process that java script is doing in python but the fields that the java script updates come up are read only variables(fields are- gtrnFileId, gtrnFieldId_UID and similarly for trp).

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.