Access denied calling FireEvent in Python

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • calfdog@yahoo.com

    #1

    Access denied calling FireEvent in Python

    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('Int ernetExplorer.A pplication')

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

    ie.Document.for ms[0].campus.value = '200'
    ie.Document.for ms[0].campus.fireEve nt('onchange')

    HTML code:
    <select style="font-size: 10" name="campus" onChange="if
    (this.options[this.selectedIn dex].value != 0)
    populate(this.o ptions[this.selectedIn dex].value)">
    <option value=0>Select a campus
    <option value="200">Nor man Campus
    <option value="501">Adv anced Programs
    <option value="502">Lib eral Studies
    <option value="504">Aca demic Programs (CAFE)
    <option value="505">OU Tulsa</select>


    If you call:
    fireEvent('onch ange')
    fireEvent('oncl ick')
    fireEvent('onFo cus') 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.for ms[0].campus.fireEve nt('onchange')

    Trace:
    File
    "C:\Python23\Li b\site-packages\python win\pywin\frame work\scriptutil s.py",
    line 310, in RunScript
    exec codeObject in __main__.__dict __
    File "C:\QA\Tools\cP AMIE150\oCScrip t2.py", line 24, in ?
    ie2.Document.fo rms[0].campus.fireEve nt('onchange')
    File "C:\Python23\Li b\site-packages\win32c om\client\dynam ic.py", line
    165, in __call__
    return
    self._get_good_ object_(self._o leobj_.Invoke(* allArgs),self._ olerepr_.defaul tDispatchName,N one)
    com_error: (-2147024891, 'Access is denied.', None, None)

    Help would be much appreciated!!

    RLM

  • calfdog@yahoo.com

    #2
    Re: Access denied calling FireEvent in Python

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

    ie.Document.for ms[0].campus.fi­reEv ent('onchange')

    if needs to be changed to:
    ie.Document.for ms[0].campus.Fi­reEv ent('onchange')


    RLM



    calfdog@yahoo.c om wrote:[color=blue]
    > 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[/color]
    the[color=blue]
    > code below. I get an "access denied" error.
    >
    > example code:
    > ie = DispatchEx('Int ernetExplorer.A pplication')
    >
    > # Some code to navigate to the site, wait till doc is not busy and #
    > ReadyState is complete...blah ..blah...
    >
    > ie.Document.for ms[0].campus.value = '200'
    > ie.Document.for ms[0].campus.fireEve nt('onchange')
    >
    > HTML code:
    > <select style="font-size: 10" name="campus" onChange="if
    > (this.options[this.selectedIn dex].value != 0)
    > populate(this.o ptions[this.selectedIn dex].value)">
    > <option value=0>Select a campus
    > <option value="200">Nor man Campus
    > <option value="501">Adv anced Programs
    > <option value="502">Lib eral Studies
    > <option value="504">Aca demic Programs (CAFE)
    > <option value="505">OU Tulsa</select>
    >
    >
    > If you call:
    > fireEvent('onch ange')
    > fireEvent('oncl ick')
    > fireEvent('onFo cus') 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.for ms[0].campus.fireEve nt('onchange')
    >
    > Trace:
    > File
    >[/color]
    "C:\Python23\Li b\site-packages\python win\pywin\frame work\scriptutil s.py",[color=blue]
    > line 310, in RunScript
    > exec codeObject in __main__.__dict __
    > File "C:\QA\Tools\cP AMIE150\oCScrip t2.py", line 24, in ?
    > ie2.Document.fo rms[0].campus.fireEve nt('onchange')
    > File "C:\Python23\Li b\site-packages\win32c om\client\dynam ic.py",[/color]
    line[color=blue]
    > 165, in __call__
    > return
    >[/color]
    self._get_good_ object_(self._o leobj_.Invoke(* allArgs),self._ olerepr_.defaul tDispatchName,N one)[color=blue]
    > com_error: (-2147024891, 'Access is denied.', None, None)
    >
    > Help would be much appreciated!!
    >
    > RLM[/color]

    Comment

    • calfdog@yahoo.com

      #3
      Re: Access denied calling FireEvent in Python

      Regarding the call to FireEvent:

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

      In Ruby or Perl you still call "fi­reEvent('on change')" 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


      calfdog@yahoo.c om wrote:[color=blue]
      > Found that you have to call FireEvent a different way in the News IE
      > and sp2
      > Instead of:
      >
      > ie.Document.for ms[0].campus.fi­reEv ent('onchange')
      >
      > if needs to be changed to:
      > ie.Document.for ms[0].campus.Fi­reEv ent('onchange')
      >
      >
      > RLM
      >
      >
      >
      > calfdog@yahoo.c om wrote:[color=green]
      > > 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[/color]
      > the[color=green]
      > > code below. I get an "access denied" error.
      > >
      > > example code:
      > > ie = DispatchEx('Int ernetExplorer.A pplication')
      > >
      > > # Some code to navigate to the site, wait till doc is not busy and[/color][/color]
      #[color=blue][color=green]
      > > ReadyState is complete...blah ..blah...
      > >
      > > ie.Document.for ms[0].campus.value = '200'
      > > ie.Document.for ms[0].campus.fireEve nt('onchange')
      > >
      > > HTML code:
      > > <select style="font-size: 10" name="campus" onChange="if
      > > (this.options[this.selectedIn dex].value != 0)
      > > populate(this.o ptions[this.selectedIn dex].value)">
      > > <option value=0>Select a campus
      > > <option value="200">Nor man Campus
      > > <option value="501">Adv anced Programs
      > > <option value="502">Lib eral Studies
      > > <option value="504">Aca demic Programs (CAFE)
      > > <option value="505">OU Tulsa</select>
      > >
      > >
      > > If you call:
      > > fireEvent('onch ange')
      > > fireEvent('oncl ick')
      > > fireEvent('onFo cus') 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[/color][/color]
      being[color=blue][color=green]
      > > handled in Python.
      > >
      > >
      > > example code:
      > > ie.Document.for ms[0].campus.fireEve nt('onchange')
      > >
      > > Trace:
      > > File
      > >[/color]
      >[/color]
      "C:\Python23\Li b\site-packages\python win\pywin\frame work\scriptutil s.py",[color=blue][color=green]
      > > line 310, in RunScript
      > > exec codeObject in __main__.__dict __
      > > File "C:\QA\Tools\cP AMIE150\oCScrip t2.py", line 24, in ?
      > > ie2.Document.fo rms[0].campus.fireEve nt('onchange')
      > > File "C:\Python23\Li b\site-packages\win32c om\client\dynam ic.py",[/color]
      > line[color=green]
      > > 165, in __call__
      > > return
      > >[/color]
      >[/color]
      self._get_good_ object_(self._o leobj_.Invoke(* allArgs),self._ olerepr_.defaul tDispatchName,N one)[color=blue][color=green]
      > > com_error: (-2147024891, 'Access is denied.', None, None)
      > >
      > > Help would be much appreciated!!
      > >
      > > RLM[/color][/color]

      Comment

      Working...