cPAMIE - Python interface to IE

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Aswin
    New Member
    • Sep 2006
    • 2

    #1

    cPAMIE - Python interface to IE

    Hi,

    I just tried to run a sample test by the following script:

    import cPAMIE as PAMIE
    ie = PAMIE( )
    ie.Navigate("'w ww.google.com" )
    ie.textBoxSet(" q", "python" )
    ie.buttonClick( "'btnG" )


    But am getting the following error.

    Traceback (most recent call last):
    File "C:\pamie\MyTes t.py", line 8, in ?
    ie = PAMIE( )
    TypeError: 'module' object is not callable


    Can any one tell me the reason for this failure.Is there any other open source tool which uses python for Web testing.

    Thanks,
    Aswin.
  • bartonc
    Recognized Expert Expert
    • Sep 2006
    • 6478

    #2
    If cPAMIE is a module and there is function or class in it named PAMIE, call that function or class like this:

    import cPAMIE
    cPAMIE.PAMIE()

    If you

    import cPAMIE as PAMIE

    then it's:

    PAMIE.PAMIE()

    which can get confusing.
    Another thing that is useful, but is often discouraged is

    from cPAMIE import *

    which means import all names form the module into the current namespace.

    You can then simply call:
    PAMIE().

    Have fun!

    Comment

    • bartonc
      Recognized Expert Expert
      • Sep 2006
      • 6478

      #3
      Hi All,

      someone please help me with this.. I have just set up PAMIE cPAMIE.pyc etc in the Python24 root which is not explained anywhere.. So I'm not even sure if I have that set up correctly (but IE opens so I assume its right). My biggest problem at the mo is this..

      C:\>PamieTEST.p y
      Traceback (most recent call last):
      File "C:\PamieTEST.p y", line 8, in ?
      ie.Navigate("ht tp://10.3.0.60/")
      AttributeError: PAMIE instance has no attribute 'Navigate'

      the code is below

      from winGuiAuto import win32gui
      from cPAMIE import PAMIE
      from cModalPopUp import handlePopup
      import time,os,sys,os. path

      ie = PAMIE()
      ie.Navigate("ht tp://10.3.0.60/")

      Why is this happening, is my module incorrectly set or do I need to install something else. Can someone also point me to some documentation explaining how to actually set up new modules in Python so I don't have to trial and error every tedious thing.

      Thanks,
      easy
      Last edited by bartonc; Jan 3 '07, 07:28 AM. Reason: No such member - easy snuck this in

      Comment

      • bartonc
        Recognized Expert Expert
        • Sep 2006
        • 6478

        #4
        Here is a link to a previous discussion.

        Comment

        • bartonc
          Recognized Expert Expert
          • Sep 2006
          • 6478

          #5
          Originally posted by bartonc
          Here is a link to a previous discussion.
          I haven't tested this:
          Code:
          # To use Pamie you must first create a new script or text file that you can saveas mytest.py. 
          
          # This will import the cPAMIE class file so you can use it's methods 
          
          from cPAMIE import PAMIE 
          
          # create a new instance of the PAMIE object 
          
          ie = PAMIE( ) 
          
          # Lets navigate to google - this methods takes a string as the URL 
          
          ie.navigate("'www.google.com" ) 
          
          ie.textBoxSet("q", "python" ) #control name, value 
          
          # Now Submit the form. 
          
          ie.buttonClick("'btnG" )
          but it should work now after changing "Navigate" to "navigate".
          this site's documentation has not been updated lately and has no "feedback" area for me to get them to fix it.

          Comment

          • bartonc
            Recognized Expert Expert
            • Sep 2006
            • 6478

            #6
            Originally posted by easyrider27
            Hi All,

            someone please help me with this.. I have just set up PAMIE cPAMIE.pyc etc in the Python24 root which is not explained anywhere.. So I'm not even sure if I have that set up correctly (but IE opens so I assume its right). My biggest problem at the mo is this..

            C:\>PamieTEST.p y
            Traceback (most recent call last):
            File "C:\PamieTEST.p y", line 8, in ?
            ie.Navigate("ht tp://10.3.0.60/")
            AttributeError: PAMIE instance has no attribute 'Navigate'

            the code is below

            from winGuiAuto import win32gui
            from cPAMIE import PAMIE
            from cModalPopUp import handlePopup
            import time,os,sys,os. path

            ie = PAMIE()
            ie.Navigate("ht tp://10.3.0.60/")

            Why is this happening, is my module incorrectly set or do I need to install something else. Can someone also point me to some documentation explaining how to actually set up new modules in Python so I don't have to trial and error every tedious thing.

            Thanks,
            easy
            I broke down and unzipped cPAMIE tonight. Since you can import it there is no issue there, but I put things like this in D:\Python24\Lib \site-packages. site-packages are not disturbed when you update python and most msi's unpack there. The problem is that some smart-alec changed the name to 'navigate' (small "n"). Have fun!

            Comment

            • bartonc
              Recognized Expert Expert
              • Sep 2006
              • 6478

              #7
              Honestly, people, there really is an easyrider27. He/she is just not a member yet. I'm not going crazy or posting the hear the sound of my own keyboard. This clever person figured out how to post a question without signing up. I have high hopes that this person will become a member of our community, as we need all the clever people we can get posting in this forum.

              Comment

              Working...