Что нового

[Данные, строки] Сравнение двух чисел и переход( обход капчи)

Kushlak

Новичок
Сообщения
2
Репутация
0
Версия AutoIt: 3.1

Описание:
Код:
<div class="header_rek">Вход</div><div class="boxWhite1">4242
Выбирете верную комбинацию цифр:

			<a href="/index.php?rnd=1602">1602</a> | 
			<a href="/index.php?rnd=9831">9831</a> | 
			<a href="/index.php?rnd=4242">4242</a> | 
			<a href="/index.php?rnd=9197">9197</a>
Подскажите, как сравнить эти цифры и нажать на нужные?
Примечания:
До сих пор использовал только цвета и пиксели((
 

Arei

Скриптер
Сообщения
938
Репутация
115
Код:
#include<Array.au3>

$var = '<div class="header_rek">Вход</div><div class="boxWhite1">4242
Выбирете верную комбинацию цифр:
<a href="/index.php?rnd=1602">1602</a> | <a href="/index.php?rnd=9831">931</a> | 	<a href="/index.php?rnd=4242">4242</a> | <a href="/index.php?rnd=9197">9197</a>'
Local $arr[5]

For $i = 1 To 4
	$a = StringFindSE($var, 'index.php?rnd=', '">', $i)
	$arr[$i] = $a
	
Next

_ArraySort($arr, 0, 1, 4)


Func StringFindSE($string, $start = "", $end = "", $start_occ = 1, $end_occ = 1, $cas = 0)
	Local $source_start, $source_count, $source
	If $start <> '' Then
		Local $st_count
		$st_count = StringSplit($start, '')
		$source_start = StringInStr($string, $start, $cas, $start_occ) + $st_count[0]
	Else
		$source_start = 1
	EndIf
	If $end <> '' Then
		$source_count = StringInStr($string, $end, $cas, $end_occ, $source_start) - $source_start
	Else
		$source_count = -1
	EndIf
	Return StringMid($string, $source_start, $source_count)
EndFunc   ;==>StringFindSE

я их так сортировал, а уже как кликать, надо смотреть по сайту.
 

madmasles

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

$iError = 1
$sUrl = @ScriptDir & '\test.htm';url
$oIE = _IECreate($sUrl)
$oDivs = _IETagNameGetCollection($oIE, 'div')
For $oDiv In $oDivs
	If $oDiv.classname == 'boxWhite1' Then
		$aTemp = StringRegExp($oDiv.innertext, '\d{4}', 3);1
		If @error Then ExitLoop
		ConsoleWrite('Search num: ' & $aTemp[0] & @LF)
		;---
		$sTemp = StringLeft($oDiv.innertext, 4);2
		ConsoleWrite('sTemp: ' & $sTemp & @LF)
		$sTemp1 = StringRegExpReplace($oDiv.innertext, '^\d{4}.*$', '');3
		ConsoleWrite('sTemp1: ' & $sTemp1 & @LF)
		;---
		$oLinks = _IETagNameGetCollection($oDiv, 'a')
		If @error Then ExitLoop
		For $oLink In $oLinks
			If StringInStr($oLink.href, $aTemp[0]) Then ; or StringInStr($oLink.innertext, $aTemp[0])
				ConsoleWrite('Text and href: ' & $oLink.innertext & @TAB & $oLink.href & @LF)
				_IEAction($oLink, 'click')
				If @error Then ExitLoop
				_IELoadWait($oIE)
				If @error Then ExitLoop
				$iError = 0
				ExitLoop 2
			EndIf
		Next
	EndIf
Next
ConsoleWrite('iError: ' & $iError & @LF)

На будущее. Лучше приводить больше HTML-кода, а еще лучше - реальный адрес.
 
Автор
K

Kushlak

Новичок
Сообщения
2
Репутация
0
[Автоматизация] Re: [Данные, строки] Сравнение двух чисел и переход( обход капчи)

Код:
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ru">
<head><title>Test.RU::Панель упровления
</title>
<meta http-equiv="Content-Type" content="text/html; windows-1251" />
<meta name="description" content=""/>
<meta name="keywords" content=""/>
<meta name="author" content="dimka"/>
<link rel="stylesheet" href="style.css" type="text/css" />
<link rel="shortcut icon" href="favicon.ico" /><script type="text/javascript">
  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-29799896-1']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();

</script>
</head><body><div class="bg">
<div class="head"><img src="img/logo.gif" alt="" /></div>
<div class="rek"><a href='http://test2.ru/'><font color='#ff8c00'><b>Заработать 320 рублей!</b></font></a>
</div><div class="header_rek">Переход по ссылкам</div><div class="boxWhite1">8395
Выбирете верную комбинацию цифр:

			<a href="/index.php?rnd=7927">7927</a> | 
			<a href="/index.php?rnd=9618">9618</a> | 
			<a href="/index.php?rnd=8395">8395</a> | 
			<a href="/index.php?rnd=1351">1351</a>
			</div><div class="boxSilver2">На сайте: [<a href='online.php?&amp;u' class='white'>3</a>/<a href='online.php?&amp;g' class='white'>1</a>]</div><div class="location"><a href="/enter.php?"><b>В кабинет</b></a></div><div class="boxWhite2"><a href="http://site2.net">Реклама</a>
</div><div class="copy">
	© 2008-2011 <a href="http://Test.ru">test.ru</a></div><div class="foot"><a href="reklam.php">Рекламодателям</a>
</div>
</div></body></html>
Сайт на денвере, а как быть с оперой - через Ie не захожу никогда. Библиотеку скачал, но таких функций нет(
 
Верх