Что нового

[Автоматизация] Как кликнуть в изображение имеющий разные ID

Сообщения
33
Репутация
3
Добрый день!
Как с функции _IE кликнуть в изображение имеющий разные ID=

Код:
<div class="tab_content" id="Line1" style="display: block;">
	<div id="Line">	
		<div style="top: 0px; left: 154px; cursor: pointer;" id="Lineid_60372" class="Line_img"></div>
		<div style="top: -40px;  left: 77px;  cursor: pointer;" id="Lineid_61321" class="Line_img gotovo1"></div>
		<div style="top: -80px;  left: 0px;   cursor: pointer;" id="Lineid_62146" class="Line_img gotovo1"></div>
		<div style="top: -204px; left: 231px; cursor: pointer;" id="Lineid_69164" class="Line_img gotovo1"></div>
		<div style="top: -244px; left: 154px; cursor: pointer;" id="Lineid_70593" class="Line_img gotovo1"></div>
		<div style="top: -284px; left: 77px;  cursor: pointer;" id="Lineid_70594" class="Line_img gotovo1"></div>
		<div style="top: -408px; left: 308px; cursor: pointer;" id="Lineid_73324" class="Line_img gotovo1"></div>
		<div style="top: -448px; left: 231px; cursor: pointer;" id="Lineid_73325" class="Line_img gotovo1"></div>
		<div style="top: -488px; left: 154px; cursor: pointer;" id="Lineid_76084" class="Line_img gotovo1"></div>			
	</div>
	<div id="Line">	
		<div style="top: 0px; left: 154px; cursor: pointer;" id="Lineid_76139" class="Line_img gotovo1"></div>
		<div style="top: -40px;  left: 77px;  cursor: pointer;" id="Lineid_88354" class="Line_img gotovo1"></div>
		<div style="top: -80px;  left: 0px;   cursor: pointer;" id="Lineid_88355" class="Line_img gotovo1"></div>
		<div style="top: -204px; left: 231px; cursor: pointer;" id="Lineid_92876" class="Line_img gotovo1"></div>
		<div style="top: -244px; left: 154px; cursor: pointer;" id="Lineid_92877" class="Line_img gotovo1"></div>
		<div style="top: -284px; left: 77px;  cursor: pointer;" id="Lineid_96212" class="Line_img gotovo1"></div>
		<div style="top: -408px; left: 308px; cursor: pointer;" id="Lineid_96213" class="Line_img gotovo1"></div>
		<div style="top: -448px; left: 231px; cursor: pointer;" id="Lineid_96214" class="Line_img gotovo1"></div>
	</div>
</div>

нам нужен кликнуть на всех по порядку в этой (id="Lineid_96214"), можно как не будь в такое организовать id= "Lineid_*"

к примеру можно через _IEObjGetById($oIE, "Lineid_96214") затем _IEAction($oIE, "click") , но при каждый обновление страниц id="Lineid_измениться"

Заране благодарен!
 

madmasles

Модератор
Глобальный модератор
Сообщения
7,790
Репутация
2,322
Se7enstars
Можно примерно так.
Код:
#include <IE.au3>

Local $oIE, $oParentDiv, $oDivs

Do
	$oIE = _IECreate(@ScriptDir & '\1.html'); Ваша ссылка
	If @error Then ExitLoop
	$oParentDiv = _IEGetObjById($oIE, 'Line1')
	If @error Then ExitLoop
	$oDivs = _IETagNameGetCollection($oParentDiv, 'div')
	If @error Then ExitLoop
	For $oDiv In $oDivs
;~ 		If StringInStr($oDiv.id, 'Lineid_') = 1 Then
		If StringRegExp($oDiv.id, '(?i)^lineid_\d+$') Then
			ConsoleWrite($oDiv.ClassName & @LF)
;~ 			_IEAction($oDiv, 'click')
;~ 			If @error Then ContinueLoop
;~ 			_IELoadWait($oIE)
;~ 			If @error Then ContinueLoop
		EndIf
	Next
Until 1
If @error Then
	ConsoleWrite('Error' & @LF)
Else
	ConsoleWrite('OK!' & @LF)
EndIf

PS
Уберите рекламную ссылку из подписи.
 
Верх