[python-win32] makepy or genpy issue: no get_accChildCount?

2010-01-27 Thread Xin Zhao
Hey,

I am trying to use pywin32 to do program automation. Basically, I need to
get an IAccessible object and call functions on it.

Here is what I did:

x = pythoncom.AccessibleObjectFromWindow(3803742, 0,
pythoncom.IID_IDispatch)
(3803742 is the HWND of an internet explorer window)

Then I do:
z = win32com.client.gencache.EnsureDispatch(x)

Now "z" is an IAccessiable object:
win32com.gen_py.1EA4DBF0-3C3B-11CF-810C-00AA00389B71x0x1x1.IAccessible.IAccessible
instance at 0x15279168

But when I did "dir(z)", I only see:
['CLSID', 'GetaccDefaultAction', 'GetaccDescription', 'GetaccHelp',
'GetaccHelpTopic', 'GetaccKeyboardShortcut', 'Getacc
Name', 'GetaccRole', 'GetaccState', 'GetaccValue', 'SetaccName',
'SetaccValue', '_ApplyTypes_', '__doc__', '__eq__', '__
getattr__', '__init__', '__module__', '__ne__', '__repr__', '__setattr__',
'_get_good_object_', '_get_good_single_object
_', '_oleobj_', '_prop_map_get_', '_prop_map_put_', 'accChild',
'accDoDefaultAction', 'accHitTest', 'accLocation', 'accN
avigate', 'accSelect', 'coclass_clsid']

Although MSDN lists function *get_accChildCount* as a function IAccessible
must support,
I don't see it in the method list of "z". Why?

Please help! Thanks a lot!

xin
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


[python-win32] Help! How to get IHTMLDocument3 dispatch object?

2010-05-26 Thread Xin Zhao
Hey,

I am trying to get the Dispatch object of IHTMLDocument3, so I wrote the
following code

wo = pythoncom.New('InternetExplorer.Application')
wo.QueryInterface('{3050F673-98B5-11CF-BB82-00AA00BDCE0B}')

But got the following error:
pywintypes.com_error: (-2147467262, 'No such interface supported', None,
None)

Any idea on how to address this problem?

Thanks,
xin
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


[python-win32] Please help! How to get the event handler with IE Dom interfaces?

2010-05-26 Thread Xin Zhao
Hey all,

I am using pywin32 code get all event handlers defined in a HTML page in IE.
 I used pythoncom to start IE, then get document, and finally reached
IHTMLElement object.  If the html page defines "onclick=xxx",
element.onclick returns the click handler. However, if an event handler is
defined in javascript, element.onclick simply returns NULL. What's the right
way to get the event handler then?

Note: I don't have to know detail about the event handler. It's good enough
to know that an event handler is associated with an element.

Thanks,
xin

Below is an example that uses javascript to define event handler.



  

 
  
  

  $(document).ready(function(){
$("a").click(function(event){
  $(this).hide("slow");
  alert("Thanks for visiting!");
  window.location="http://cnn.com";;
});
  });

jQuery
  

___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Help! How to get IHTMLDocument3 dispatch object?

2010-05-27 Thread Xin Zhao
I am not sure I follow you.

What I did was:

---
>>> wo = pythoncom.New('InternetExplorer.Application')
>>> import win32com.client
>>> w = win32com.client.Dispatch(wo)
>>> w.Navigate('http://google.com')
>>> doc = w.Document
>>> wo.QueryInterface('{3050f485-98b5-11cf-bb82-00aa00bdce0b}')
Traceback (most recent call last):
  File "", line 1, in ?
pywintypes.com_error: (-2147467262, 'No such interface supported', None,
None)

>>> w.QueryInterface('{3050f485-98b5-11cf-bb82-00aa00bdce0b}')
Traceback (most recent call last):
  File "", line 1, in ?
  File ">", line 2, in QueryInterface
pywintypes.com_error: (-2147352573, 'Member not found.', None, None)

---

Am I missing something? Why does it simply complain that this interface is
not supported? It's indeed supported from MSDN document...

Thanks,
xin

On Thu, May 27, 2010 at 11:25 AM, Tim Roberts  wrote:

> Xin Zhao wrote:
> > Thanks for your kind reply.
> >
> > I tried the new iid, doesn't help. :(
> >
> > >>> import pythoncom
> > >>> wo=pythoncom.New('InternetExplorer.Application')
> > >>> wo.QueryInterface('{3050f485-98b5-11cf-bb82-00aa00bdce0b}')
> > Traceback (most recent call last):
> >   File "", line 1, in ?
> > pywintypes.com_error: (-2147467262, 'No such interface supported',
> > None, None)
> >
> > Any further idea?
>
> Yes.  The Internet Explorer application doesn't support that interface,
> because a single IE instance can have multiple documents.  "wo" will be
> an instance of IWebBrowser2.  You need to fetch a document from that
> interface, then fetch the IHTMLDocument3 interface from that.  You want
> the Document property, which is either:
>doc = wo.Document
> or
>doc = wo.get_Document()
>
> That "doc" object should be an IHTMLDocument2.  If you really need the
> "...3" version, that's where you do the QueryInterface.
>
> --
> Tim Roberts, t...@probo.com
> Providenza & Boekelheide, Inc.
>
> ___
> python-win32 mailing list
> python-win32@python.org
> http://mail.python.org/mailman/listinfo/python-win32
>
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


[python-win32] comtypes + mshtml was slow to me, any suggestion?

2014-02-15 Thread Xin Zhao
Hey,

I am trying to build a test tool using comtypes and mshtml to handle some
applications that have IE activex control, which renders some logics
predefined in an HTML file. But I have two issues:


   1. I did "from comtypes.client import GetModule" and then
   "GetModule('mshtml.tlb')". It took a few minutes to finish this function.
   The second run was faster, but still took about 6 seconds. Is this normal?
   2. I usee comtypes to get IHTMLDocument2 interface, and then enumerate
   all HTML elements in the application. But for some page, it took more than
   2 minutes to process. This seems to be way too slow. I think I must miss
   something. But have no clue about it.

Can someone help?

Thanks,
-X
___
python-win32 mailing list
python-win32@python.org
https://mail.python.org/mailman/listinfo/python-win32