[pywin32-bugs] [ pywin32-Bugs-3562879 ] win32com and PAMIE 3
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
From: SourceForge.net <no...@so...> - 2012-11-24 10:56:56
|
Bugs item #3562879, was opened at 2012-08-29 08:34 Message generated for change (Comment added) made by fraca7 You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=551954&aid=3562879&group_id=78018 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: com Group: None Status: Closed Resolution: Invalid Priority: 5 Private: No Submitted By: Raveesh (spaniard81) Assigned to: Nobody/Anonymous (nobody) Summary: win32com and PAMIE 3 Initial Comment: I am trying to run the Simple Example to automate a google search on "Python" http://mail.python.org/pipermail/python-announce-list/2009-March/007279.html ###################################################### from PAM30 import PAMIE ie = PAMIE() ie.navigate("google.com") ie.setTextBox("q", "python") ie.clickButton("Google Search") ie.clickLink("Python Programming Language -- Official Website") ###################################################### I have the exact same setup as mentioned in the note by Rob Marchetti. Note:This version only only works with Python 3.0 on Windows and requires Mark Hammond's pywin32 for Python3.0 - pywin32-213.win32-py3.0.exe But i get the following error: TypeError: getElementsByTagName() takes exactly 1 positional argument (2 given) Details: Traceback (most recent call last): File "testPAM.py", line 10, in <module> ie.setTextBox("q", "python") File "C:\Users\raveesh\Dropbox\myCode\SSSB\PAM30.py", line 2093, in setTextBox foundElement = self.getTextBox(name) File "C:\Users\raveesh\Dropbox\myCode\SSSB\PAM30.py", line 1717, in getTextBox foundElement = self.findElement("input", "id;name;value", name) File "C:\Users\raveesh\Dropbox\myCode\SSSB\PAM30.py", line 445, in findElement elements = self.getElementsList(tag) File "C:\Users\raveesh\Dropbox\myCode\SSSB\PAM30.py", line 939, in getElementsList elements = self._ie.Document.getElementsByTagName(tag) TypeError: getElementsByTagName() takes exactly 1 positional argument (2 given) Python on my machine: Python 3.0.1 (r301:69561, Feb 13 2009, 20:04:18) [MSC v.1500 32 bit (Intel)] on win32 The bug has also been reported on http://stackoverflow.com/questions/11580340/typeerror-with-pamie with no solution! ---------------------------------------------------------------------- Comment By: Jérome Laheurte (fraca7) Date: 2012-11-24 02:56 Message: The problem is, the recognized signature is empty (no argument except self). So no tag name to pass... But I concur that this is probably an IE bug, not a pywin32 one. A colleague of mine suggested that this may be related to the fact that IHTMLDocument8 inherits from IUnknown instead of IDispatch, but we don't know enough COM-fu to be sure. ---------------------------------------------------------------------- Comment By: Mark Hammond (mhammond) Date: 2012-11-23 21:59 Message: I'm really not sure what pywin32 can do to work around this, given it is IE which has decided the signature of this function should change. I can only suggest PAMIE try and work around the problem by, eg, catching the exception and retrying with 2 args (or sniffing the IE version, etc) ---------------------------------------------------------------------- Comment By: Desmond Cox (desmondgc) Date: 2012-11-16 13:30 Message: I am seeing the same issue with my own custom IE automation script. Only started since "upgrade" to IE 9. "Workaround" seems to be enable Compatibility View (Tools > Compatibility View settings > Display all websites in Compatibility View). ---------------------------------------------------------------------- Comment By: Raveesh (spaniard81) Date: 2012-10-04 13:55 Message: also PAM30.py is not compatible with Python 3 or higher versions. One will need to do some code modifications in PAM30.py like include new packages instead of the existing ones, and modify the print statements to the new print() function. But this is not as bad as the issues with IE 9. I will try to revert my IE to earlier versions. ---------------------------------------------------------------------- Comment By: Raveesh (spaniard81) Date: 2012-10-04 13:51 Message: As Jérome Laheurte (fraca7) mentioned this this appears to be an issue with Internet Explorer 9. I ran the same code on my Win Vista a week back and the code worked. I presume i still had IE 8 or earlier version on my machine. However, since the last Win update it appears IE 9 has been installed on my machine and this stops working again. ---------------------------------------------------------------------- Comment By: Jérome Laheurte (fraca7) Date: 2012-09-16 21:56 Message: Thanks. ---------------------------------------------------------------------- Comment By: Mark Hammond (mhammond) Date: 2012-09-16 16:55 Message: I'll try and look into this soon. ---------------------------------------------------------------------- Comment By: Jérome Laheurte (fraca7) Date: 2012-09-16 02:20 Message: This is still "pending"... Should I open another bug report for my own situation ? ---------------------------------------------------------------------- Comment By: Jérome Laheurte (fraca7) Date: 2012-08-30 04:51 Message: This has nothing to do with Python 3 or PAM. I get the same error using this script (with Python 2.2, win32all build 210, as well as Python 2.5 and win32all build 217). It only happens with MSIE 9. Fun thing is that on a site like Baidu (commented line here), which uses compatibility mode IFAIK, it works. Tested on Win7 Ultimate 32 bits. import win32com.client import time ie = win32com.client.Dispatch('InternetExplorer.Application.1') try: ie.Visible = 1 ie.Navigate("http://www.google.com") # ie.Navigate("http://www.baidu.com") while ie.Busy: time.sleep(1) print ie.Document.getElementsByTagName("a") finally: ie.Quit() ---------------------------------------------------------------------- Comment By: Raveesh (spaniard81) Date: 2012-08-30 02:22 Message: i am running this on a 64bit Win7, Intel machine, if that has anything to do with this. ---------------------------------------------------------------------- Comment By: Raveesh (spaniard81) Date: 2012-08-30 02:21 Message: Hi, following you suggestion i upgraded to Python 3.x. Here is the exact version: Python 3.2.3 (default, Apr 11 2012, 07:15:24) [MSC v.1500 32 bit (Intel)] on win32 And i have installed pywin32-217.win32-py3.2 from sourceforge I still get the same TypeError: getElementsByTagName() takes exactly 1 positional argument (2 given) ---------------------------------------------------------------------- Comment By: Roger Upole (rupole) Date: 2012-08-29 09:03 Message: The first thing to try is using a newer version of Python 3. There were enough problems with Python 3.0 that pywin32 is no longer released for it. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=551954&aid=3562879&group_id=78018 |