Teleseil Posted February 23, 2021 Posted February 23, 2021 Hello! I faced with such problem - in HTML code exist two sets of DIV tags with similar attributes title. I need click on div "Cayman Islands - George Town" in the second div sets. With my code it's always click on title in first set of divs. HTML code (I need to click on div marked on yellow): My code: $objs = _IETagNameGetCollection($oIE, "div") For $obj In $objs If String($obj.title) = "Cayman Islands - George Town" Then _IEAction($obj, "click") _IELoadWait($oIE, 2000) ExitLoop EndIf Next Tried this too: $objs = _IETagNameGetCollection($oIE, "div") For $obj In $objs If $obj.classname == 'raceway canada' Then _IEAction($obj, "click") _IELoadWait($oIE, 1000) ExitLoop EndIf Next Also tried code below but it's always click on div titled "Mexico - Ciudad Juarez": $objs = _IETagNameGetCollection($oIE, "div") $b = 0 For $obj In $objs If String($obj.title) = "Cayman Islands - George Town" Then $b = $b+1 If ($b==2) then _IEAction($obj, "click") _IELoadWait($oIE, 2000) EndIf ExitLoop EndIf Next I can't find any correct solution.
Nine Posted February 23, 2021 Posted February 23, 2021 (edited) Try this : $oIE = _IECreate(......) $oDiv2 = _IEGetObjById($oIE, "tab4-2") If Not IsObj($oDiv2) Then Exit MsgBox($MB_SYSTEMMODAL, "", "not an object") $objs = _IETagNameGetCollection($oDiv2, "div") For $obj In $objs If $obj.title = "Cayman Islands - George Town" Then _IEAction($obj, "click") _IELoadWait($oIE, 2000) ExitLoop EndIf Next Edited February 23, 2021 by Nine no need for string function Teleseil and Danp2 2 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
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