473,398 Members | 2,403 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

win32: disappearing IE attributes

I'm having problems with some attributes in Internet Explorer.

I'm trying to figure out how to set things up so I don't have to do my
own event loop even though I'm using DispatchWithEvents()

The reason why is that I'm doing lots of "looking at the IE Document
object then poking IE" processing. Specifically I'm trying to
implement an IE "object" that you can use to write "macro" scripts to
do long and boring point'n'click routines in Oracle Portal.

One of the reasons I need to use DispatchWithEvents() is to grab the
OnNewWindow2 event and get a reference to any new windows that get
opened either by javascript or targeted links. Otherwise I'd not use
events, which releases you from needing to pump events.

I've read "Python Programming on Win32" (and tried really hard to grok
Appendix D) and googled until they threatened to block my IP address.

example #1
import time
import pythoncom as pc
import win32com.client as wc

class EventsClass:
pass

ie=wc.DispatchWithEvents('InternetExplorer.Applica tion.1', EventsClass)
ie.Visible=1
ie.Navigate('http://www.webexpressions.com/how-to/examples/frames/frame4.htm')
while ie.ReadyState != 4:
time.sleep(0.25)
pc.PumpWaitingMessages()
print ie.Document.frames
print ie.Document.frames.length
for i in range(ie.Document.frames.length):
print ie.Document.frames[i].name
print ie.Document.parentWindow

while 1:
time.sleep(0.25)
pc.PumpWaitingMessages()

OK, you run this and it prints:
[object]
3
menu
header
main
[object]

This is ok except for the event loop. So experimented with
sys.coinit_flags, which does get rid of the need to pump events, but
then the "parentWindow" and "frames" attributes no longer work!!!

(the "frames" collection is the IE instances (I think) for each of the
frame subwindows, each with their own Document objects, etc)

example #2
import sys
sys.coinit_flags = 0

import time
import win32com.client as wc

class EventsClass:
pass

ie=wc.DispatchWithEvents('InternetExplorer.Applica tion.1', EventsClass)
ie.Visible=1
ie.Navigate('http://www.webexpressions.com/how-to/examples/frames/frame4.htm')
while ie.ReadyState != 4:
time.sleep(0.25)
print ie.Document.frames
print ie.Document.frames.length
for i in range(ie.Document.frames.length):
print ie.Document.frames[i].name
print ie.Document.parentWindow

Traceback (most recent call last):
File "C:\example2.py", line 15, in ?
print ie.Document.frames
File "C:\PROGRA~1\PYTHON\lib\site-packages\win32com\client\dynamic.py", line 4
54, in __getattr__
raise pythoncom.com_error, details
pywintypes.com_error: (-2147467262, 'No such interface supported', None, None)


Why is this? What's going on here?

-gc

--
Windows users [are like] people stuck in abusive relationships. They
get beat up over and over again, but they won't leave.
-- Steve VanDevender (alt.sysadmin.recovery)
Jul 18 '05 #1
0 2446

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

19
by: Dave | last post by:
Hi, I have done some research, trying to Clear The Screen in java code. The first option was the obv: system.out.print("\n\n\n\n\n\n\n\n\n\n\n\n"); then i heard about this method:...
9
by: Larry Woods | last post by:
I have a site that works fine for days, then suddenly, I start getting ASP 0115 errors with an indication that session variables IN SEPARATE SESSIONS have disappeared! First, for background...
2
by: AJ | last post by:
Hi all, I'm brand new at using Visual Studio, but I have basic programming knowledge from C++. I created a Windows form with some buttons, a tab area and tabs, and some combo boxes with a list...
2
by: Rachel Suddeth | last post by:
Here is my scenario: I have a few custom controls that I set up on a form and tested setting properties and appearances. Then I added a couple references to the project which add classes I need to...
8
by: Sue | last post by:
I have a datagrid populated with 6 visible read-only labels and several hidden fields. Below the datagrid, I have a table with various textboxes, dropdowns, etc. I've managed to decypher the...
2
by: Suzanne | last post by:
Hi all, I'm reposting this message as I'm experiencing this problem more and more frequently : I really hope someone out there can help me as I've been tearing my hair out on this one for a...
5
by: Simon | last post by:
Hi all, We have an ASP.NET 1.1 application running on IIS6 on Server 2003. Most of the base objects we are using in this application are taken from a windows application also written by us. We...
0
by: olegprog | last post by:
Dear All, I am trying to write a C# DLL that would work with VBA (in VBA I can directly call C# dll) and relatively old Win32 application (ArcView3.x). For Win32 application I would like to use C++...
0
by: =?Utf-8?B?Q2hhcmxlcw==?= | last post by:
Like many people, I normally use Yahoo! Mail via the web and like to keep all my emails stored on the Yahoo! server. However sometimes I can’t get access to a PC/the web and I download my emails...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.