webbrowser controls, javascript, Python [could use win32com]

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • waterfirefly
    New Member
    • Oct 2006
    • 2

    webbrowser controls, javascript, Python [could use win32com]

    Help!

    I have this project where the program should paste an item on a certain website's textarea and then it would be the one to click on submit so that the value of that item be returned.

    How can i manipulate javascript through Python? How can I make it paste an item then click the submit button?

    Is there anyone who can help me?? unsure.gif

    Thanks!
  • bartonc
    Recognized Expert Expert
    • Sep 2006
    • 6478

    #2
    Have you looked in Jython yet?

    Comment

    • kudos
      Recognized Expert New Member
      • Jul 2006
      • 127

      #3
      Originally posted by waterfirefly
      Help!

      I have this project where the program should paste an item on a certain website's textarea and then it would be the one to click on submit so that the value of that item be returned.

      How can i manipulate javascript through Python? How can I make it paste an item then click the submit button?

      Is there anyone who can help me?? unsure.gif

      Thanks!
      even though your problem doesn't seem to be very well formulated (for instance, what is an "item") couldn't you do something like this? (without using python at all)


      Code:
      <html>
      <body>
      <script type="text/javascript">
      
      function foo(){
      alert(document.test.me.value)
      }
      
      </script>
      
      
      <form name="test">
      <textarea name="me"></textarea>
      <input type="button" onClick="foo()">
      </form>
      </body>
      </html>
      Will make a bip, and display an alert box with the content of the textarea.

      Comment

      • waterfirefly
        New Member
        • Oct 2006
        • 2

        #4
        bartonc: No, I haven't looked into Jython yet. It's an integration of Java and Python, right? We are required to do it in Python alone..

        kudos:
        Originally posted by kudos
        even though your problem doesn't seem to be very well formulated (for instance, what is an "item") couldn't you do something like this? (without using python at all)


        Code:
        <html>
        <body>
        <script type="text/javascript">
        
        function foo(){
        alert(document.test.me.value)
        }
        
        </script>
        
        
        <form name="test">
        <textarea name="me"></textarea>
        <input type="button" onClick="foo()">
        </form>
        </body>
        </html>
        Will make a bip, and display an alert box with the content of the textarea.
        The program that I'm doing is in Python. Manually, one would be pasting certain texts in a textarea of a website, click submit, the page then would be redirected to the result, then copy and paste the result to an xml document. We were asked to automate this process. The website that I am referring to is in javascript so I figured the python program can manipulate its source. I looked into the webbrowser module but all I can do was open the url of the said website (i.e. webbrowser.open (url)). I'm relatively new to Python so if anyone can help me, I'd be very grateful =)

        Comment

        • fuffens
          New Member
          • Oct 2006
          • 38

          #5
          There are many tools (free and commercial) to record gui operations as macros. But if you insisit on using Python I would suggest to call COM functions for Internet Explorer to access text areas and submit buttons. The module win32com is installed when you install PythonWin. It is used for COM operations.

          /Fredrik

          Comment

          • bartonc
            Recognized Expert Expert
            • Sep 2006
            • 6478

            #6
            Originally posted by fuffens
            There are many tools (free and commercial) to record gui operations as macros. But if you insisit on using Python I would suggest to call COM functions for Internet Explorer to access text areas and submit buttons. The module win32com is installed when you install PythonWin. It is used for COM operations.

            /Fredrik
            Thanks, Fredrik.
            It's obvious that this is the python on windows forum. I'm sure that we all benefit from reminders of the usefulness of win32all extentions. Honestly, I forget that they are there for every-day use. I tend to turn to them when nothing else will do the trick (like serial port access).
            Keep it up,
            Barton

            Comment

            Working...