Access denied calling FireEvent in Python

C

calfdog

Hello,

Does anyone know a workaround for calling fireEvent.
With the latest from Microsoft OS XP2 and Hot fixes to
IE it now gives an "access denied" error in Python when called.

Here is what I am trying to do:
Set the "campus" listbox value and theb call fire event, such as in the
code below. I get an "access denied" error.

example code:
ie = DispatchEx('InternetExplorer.Application')

# Some code to navigate to the site, wait till doc is not busy and #
ReadyState is complete...blah..blah...

ie.Document.forms[0].campus.value = '200'
ie.Document.forms[0].campus.fireEvent('onchange')

HTML code:
<select style="font-size: 10" name="campus" onChange="if
(this.options[this.selectedIndex].value != 0)
populate(this.options[this.selectedIndex].value)">
<option value=0>Select a campus
<option value="200">Norman Campus
<option value="501">Advanced Programs
<option value="502">Liberal Studies
<option value="504">Academic Programs (CAFE)
<option value="505">OU Tulsa</select>


If you call:
fireEvent('onchange')
fireEvent('onclick')
fireEvent('onFocus') etc... You will get an Access Denied

This only happens with either the newer version of IE and XP2.
I was able to call the exact same code with XP1 and Win2000 Pro
and it work fine. So something has changed with I.E. and is not being
handled in Python.


example code:
ie.Document.forms[0].campus.fireEvent('onchange')

Trace:
File
"C:\Python23\Lib\site-packages\pythonwin\pywin\framework\scriptutils.py",
line 310, in RunScript
exec codeObject in __main__.__dict__
File "C:\QA\Tools\cPAMIE150\oCScript2.py", line 24, in ?
ie2.Document.forms[0].campus.fireEvent('onchange')
File "C:\Python23\Lib\site-packages\win32com\client\dynamic.py", line
165, in __call__
return
self._get_good_object_(self._oleobj_.Invoke(*allArgs),self._olerepr_.defaultDispatchName,None)
com_error: (-2147024891, 'Access is denied.', None, None)

Help would be much appreciated!!

RLM
 
C

calfdog

Found that you have to call FireEvent a different way in the News IE
and sp2
Instead of:

ie.Document.forms[0].campus.fi­reEvent('onchange')

if needs to be changed to:
ie.Document.forms[0].campus.Fi­reEvent('onchange')


RLM
 
C

calfdog

Regarding the call to FireEvent:

I still do not understand why you could call fi­reEvent('onchange')
and now it you have to call "Fi­reEvent('onchange')" to avoid the
Access denied message

In Ruby or Perl you still call "fi­reEvent('onchange')" it has not
changed and you do not get the access denied error.

If anyone has any helpful information regarding this it would be great.

Rob


Found that you have to call FireEvent a different way in the News IE
and sp2
Instead of:

ie.Document.forms[0].campus.fi­reEvent('onchange')

if needs to be changed to:
ie.Document.forms[0].campus.Fi­reEvent('onchange')


RLM



Hello,

Does anyone know a workaround for calling fireEvent.
With the latest from Microsoft OS XP2 and Hot fixes to
IE it now gives an "access denied" error in Python when called.

Here is what I am trying to do:
Set the "campus" listbox value and theb call fire event, such as in the
code below. I get an "access denied" error.

example code:
ie = DispatchEx('InternetExplorer.Application')

# Some code to navigate to the site, wait till doc is not busy and #
ReadyState is complete...blah..blah...

ie.Document.forms[0].campus.value = '200'
ie.Document.forms[0].campus.fireEvent('onchange')

HTML code:
<select style="font-size: 10" name="campus" onChange="if
(this.options[this.selectedIndex].value != 0)
populate(this.options[this.selectedIndex].value)">
<option value=0>Select a campus
<option value="200">Norman Campus
<option value="501">Advanced Programs
<option value="502">Liberal Studies
<option value="504">Academic Programs (CAFE)
<option value="505">OU Tulsa</select>


If you call:
fireEvent('onchange')
fireEvent('onclick')
fireEvent('onFocus') etc... You will get an Access Denied

This only happens with either the newer version of IE and XP2.
I was able to call the exact same code with XP1 and Win2000 Pro
and it work fine. So something has changed with I.E. and is not being
handled in Python.


example code:
ie.Document.forms[0].campus.fireEvent('onchange')

Trace:
File
"C:\Python23\Lib\site-packages\pythonwin\pywin\framework\scriptutils.py",
line 310, in RunScript
exec codeObject in __main__.__dict__
File "C:\QA\Tools\cPAMIE150\oCScript2.py", line 24, in ?
ie2.Document.forms[0].campus.fireEvent('onchange')
File "C:\Python23\Lib\site-packages\win32com\client\dynamic.py", line
165, in __call__
return
self._get_good_object_(self._oleobj_.Invoke(*allArgs),self._olerepr_.defaultDispatchName,None)
com_error: (-2147024891, 'Access is denied.', None, None)

Help would be much appreciated!!

RLM
 
J

Jude

Set the "campus" listbox value and theb call fire event, such as in
Fire-events on campuses were forbidden by George W because of
terrorists might use them.
Jeff
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,228
Members
46,818
Latest member
SapanaCarpetStudio

Latest Threads

Top