467,161 Members | 910 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,161 developers. It's quick & easy.

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("'www.google.com" )
ie.textBoxSet("q", "python" )
ie.buttonClick("'btnG" )


But am getting the following error.

Traceback (most recent call last):
File "C:\pamie\MyTest.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.
Sep 13 '06 #1
  • viewed: 7465
Share:
6 Replies
bartonc
Expert 4TB
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!
Sep 13 '06 #2
bartonc
Expert 4TB
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.py
Traceback (most recent call last):
File "C:\PamieTEST.py", line 8, in ?
ie.Navigate("http://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("http://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
Jan 2 '07 #3
bartonc
Expert 4TB
Here is a link to a previous discussion.
Jan 2 '07 #4
bartonc
Expert 4TB
Here is a link to a previous discussion.
I haven't tested this:
Expand|Select|Wrap|Line Numbers
  1. # To use Pamie you must first create a new script or text file that you can saveas mytest.py. 
  2.  
  3. # This will import the cPAMIE class file so you can use it's methods 
  4.  
  5. from cPAMIE import PAMIE 
  6.  
  7. # create a new instance of the PAMIE object 
  8.  
  9. ie = PAMIE( ) 
  10.  
  11. # Lets navigate to google - this methods takes a string as the URL 
  12.  
  13. ie.navigate("'www.google.com" ) 
  14.  
  15. ie.textBoxSet("q", "python" ) #control name, value 
  16.  
  17. # Now Submit the form. 
  18.  
  19. ie.buttonClick("'btnG" ) 
  20.  
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.
Jan 2 '07 #5
bartonc
Expert 4TB
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.py
Traceback (most recent call last):
File "C:\PamieTEST.py", line 8, in ?
ie.Navigate("http://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("http://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!
Jan 3 '07 #6
bartonc
Expert 4TB
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.
Jan 3 '07 #7

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

reply views Thread by Phillip J. Eby | last post: by
reply views Thread by calfdog@yahoo.com | last post: by
1 post views Thread by Sam R | last post: by
1 post views Thread by romo20350@gmail.com | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.