stenioc1 Posted March 26, 2014 Share Posted March 26, 2014 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 Link to comment Share on other sites More sharing options...
Gianni Posted March 26, 2014 Share Posted March 26, 2014 maybe you should use Local $oAreas= _IETagNameGetCollection($oFrame2, "href") also, maybe is better _IELinkGetCollection instead _IETagNameGetCollection Chimp small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt.... Link to comment Share on other sites More sharing options...
Danp2 Posted March 27, 2014 Share Posted March 27, 2014 Local $oAreas= _IETagNameGetCollection($oFrame2, "href") Will probably work better with "a" instead of "href". Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
stenioc1 Posted March 27, 2014 Author Share Posted March 27, 2014 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 Link to comment Share on other sites More sharing options...
Danp2 Posted March 27, 2014 Share Posted March 27, 2014 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. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
DW1 Posted March 27, 2014 Share Posted March 27, 2014 What about something like this? $oIE.document.parentWindow.execScript("__doPostBack('dtgLista$_ctl3$_ctl0','');","javascript") AutoIt3 Online Help Link to comment Share on other sites More sharing options...
S4C Posted October 2, 2022 Share Posted October 2, 2022 Hello Team, I have a website with similar concept: I tried to click on "Request Number" link using below code but it did not work. $oWebComponent = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//a[contains(text(),'Request Number')]") _WD_ElementAction($sSession, $oWebComponent, "Click") I also tried to call JavaScript but seems I do something wrong. _WD_ExecuteScript($sSession, "__doPostBack('ctl00$PlaceHolderMain$gvDashboard','Sort$tkNum')", Default) Could someone help me on this? Thanks in advance! Link to comment Share on other sites More sharing options...
Danp2 Posted October 2, 2022 Share Posted October 2, 2022 You could try with _WD_LinkClickByText. BTW, telling us that something "doesn't work" isn't very useful without additional context. If you showed us your console output, it might help identify the reason it failed. P.S. Next time start a new thread instead of awakening the dead. 😉 Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
S4C Posted October 2, 2022 Share Posted October 2, 2022 1 minute ago, Danp2 said: You could try with _WD_LinkClickByText. BTW, telling us that something "doesn't work" isn't very useful without additional context. If you showed us your console output, it might help identify the reason it failed. P.S. Next time start a new thread instead of awakening the dead. 😉 Thanks a lot for your quick help. It works with function "_WD_LinkClickByText". I need to learn more on your recommendation "console output". I'm newbie with webdriver and Autoit. I found this post which had similar with my problem and no final conclusion. Next time, I will open new thread. Danp2 1 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now