Sign in to follow this  
Followers 0
stenioc1

How clicking in the code <a href="javascript> using _IEAction

6 posts in this topic

Hello,

I have the code that works well, opening the page and click on the links, after its not opening next link, below the code html:

<a href="javascript:__doPostBack('dtgLista$_ctl3$_ctl0','')">

I tried this code and not works:

Func ClickIncident()

$oFrame1 = _IEFrameGetObjByName($oIE, 'contents') ;OK
$oFrame2 = _IEFrameGetObjByName($oFrame1, 'main') ;OK
Local $oAreas= _IETagNameGetCollection($oIE, "href")
For $oArea In $oAreas
    if StringInStr($oArea.outerhtml,'dtgLista$_ctl3$_ctl0') <> 0 Then
        _IEAction ($oArea, "click")
        ExitLoop
    EndIf
Next

EndFunc   ;==>ClickIncident

And logs:

>"C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "C:\Users\cordeirs\Desktop\Projetos\AutoIT\teste moebius.au3" /UserParams    
+>20:14:15 Starting AutoIt3Wrapper v.2.1.4.4 SciTE v.3.3.7.0 ;  Keyboard:00000416  OS:WIN_7/Service Pack 1  CPU:X64 OS:X64    Environment(Language:0409  Keyboard:00000416  OS:WIN_7/Service Pack 1  CPU:X64 OS:X64)
>Running AU3Check (3.3.10.2)  from:C:\Program Files (x86)\AutoIt3
+>20:14:15 AU3Check ended.rc:0
>Running:(3.3.10.2):C:\Program Files (x86)\AutoIt3\autoit3.exe "C:\Users\cordeirs\Desktop\Projetos\AutoIT\teste moebius.au3"    
--> Press Ctrl+Alt+F5 to Restart or Ctrl+Break to Stop
Found 1 area elements!
+>20:14:33 AutoIt3.exe ended.rc:0
+>20:14:33 AutoIt3Wrapper Finished..
>Exit code: 0    Time: 17.740

Did not understand what I did wrong, Can you help me ?

Thanks

Share this post


Link to post
Share on other sites



maybe you should use

Local $oAreas= _IETagNameGetCollection($oFrame2, "href")

also, maybe is better _IELinkGetCollection instead _IETagNameGetCollection


small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Share this post


Link to post
Share on other sites

 

Local $oAreas= _IETagNameGetCollection($oFrame2, "href")

 

Will probably work better with "a" instead of "href".

Share this post


Link to post
Share on other sites

Hello, I tried the code change, still not working, I forgot to inform you that the code use other variables in the links, below the example:

<a href="javascript:__doPostBack('dtgLista$_ctl3$_ctl0','')">
<a href="javascript:__doPostBack('dtgLista$_ctl4$_ctl0','')">
<a href="javascript:__doPostBack('dtgLista$_ctl5$_ctl0','')"> 

I want to use the structure "for" to work the code, but I wish to use in the simple form for learning to working, below the logs:

>"C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "C:\Users\cordeirs\Desktop\Projetos\AutoIT\teste moebius.au3" /UserParams    
+>09:18:14 Starting AutoIt3Wrapper v.2.1.4.4 SciTE v.3.3.7.0 ;  Keyboard:00000416  OS:WIN_7/Service Pack 1  CPU:X64 OS:X64    Environment(Language:0409  Keyboard:00000416  OS:WIN_7/Service Pack 1  CPU:X64 OS:X64)
>Running AU3Check (3.3.10.2)  from:C:\Program Files (x86)\AutoIt3
+>09:18:15 AU3Check ended.rc:0
>Running:(3.3.10.2):C:\Program Files (x86)\AutoIt3\autoit3.exe "C:\Users\cordeirs\Desktop\Projetos\AutoIT\teste moebius.au3"    
--> Press Ctrl+Alt+F5 to Restart or Ctrl+Break to Stop
Found 1 area elements!
+>09:18:35 AutoIt3.exe ended.rc:0
+>09:18:35 AutoIt3Wrapper Finished..
>Exit code: 0    Time: 22.186

Thanks

Share this post


Link to post
Share on other sites

I would recommend that you add a consolewrite() before the _IEAction line so that you can be sure that you are actually reaching that section of code. Repost a working example of your code and the output window results.

Share this post


Link to post
Share on other sites

What about something like this?

$oIE.document.parentWindow.execScript("__doPostBack('dtgLista$_ctl3$_ctl0','');","javascript")

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0