#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2013
    Posts
    4
    Rep Power
    0

    How to - auto submitting a javascript form using python


    i report a lot of my own work to twitter to take down through their support.twitter.***/forms/dmca

    I am trying to find a way to make the process faster. i know the form is in javascript. i want to be able to prefill certain fields so that i dont have to (your full name, company, job title, email address etc). I did some research and some people say it can be done with python using urllib2. I also tried taking the html of their entire page and putting it on wamp to see if i can submit from there, but no luck.

    I was hoping some one can point me in the right direction.
  2. #2
  3. Contributing User
    Devshed Demi-God (4500 - 4999 posts)

    Join Date
    Aug 2011
    Posts
    4,837
    Rep Power
    480
    Maybe autofill using the google chromium browser would be easy enough?
    [code]Code tags[/code] are essential for python code and Makefiles!
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2013
    Posts
    4
    Rep Power
    0
    Thanks for the reply. Unfonately browser plugins are not an option. My options are any programming language that i can either load within thd page or something like python. This is because the environmet i work in is limited.
  6. #4
  7. Banned ;)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Nov 2001
    Location
    Woodland Hills, Los Angeles County, California, USA
    Posts
    9,607
    Rep Power
    4247
    Are you allowed to automate a browser or not? If so, I wrote a python module that allows you to control an IE window. This way, you can tell it to navigate to a page, fill out the appropriate form fields and then click the submit button or whatever. Any javascript that is tied to the form fields or buttons will also fire correctly. Let me know if this works for you.
    Up the Irons
    What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home.
    "Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest
    Down with Sharon Osbourne

    "I wouldn't hire a butcher to fix my car. I also wouldn't hire a marketing firm to build my website." - Nilpo
  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2013
    Posts
    4
    Rep Power
    0
    That might work for me. Can It run on ubuntu if not I can settle with windows? I was hoping to be able to run the program within the page (not specific to browser) and submit to the iframe. But I would definitely appreciate the module you put together to see if it will do my tasks.

    Thanks!
  10. #6
  11. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2013
    Posts
    4
    Rep Power
    0
    scorpion, any chance i can get that module to test out?

    thanks
  12. #7
  13. Banned ;)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Nov 2001
    Location
    Woodland Hills, Los Angeles County, California, USA
    Posts
    9,607
    Rep Power
    4247
    Sure. You can get it from this link.

    It only works on Windows, as it automates the Internet Explorer browser, so any other OS is out unfortunately. The module comes with a demo (simply run the module by itself and it'll demonstrate various form manipulations) and documentation.
    Up the Irons
    What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home.
    "Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest
    Down with Sharon Osbourne

    "I wouldn't hire a butcher to fix my car. I also wouldn't hire a marketing firm to build my website." - Nilpo

IMN logo majestic logo threadwatch logo seochat tools logo