SET !ERRORIGNORE YES
SET !EXTRACT_TEST_POPUP NO
FILEDELETE NAME=c:\temp\captcha.jpg
ONDOWNLOAD FOLDER=c:\temp\ FILE=captcha.jpg
TAG POS=1 TYPE=IMG ATTR=ID:adcopy-puzzle-image-image CONTENT=EVENT:SAVE_ELEMENT_SCREENSHOT
TAB OPEN
TAB T=2
URL GOTO=http://www.9kw.eu/grafik/form.html
TAG POS=1 TYPE=INPUT ATTR=NAME:apikey CONTENT=--API KEY HERE--
TAG POS=1 TYPE=INPUT ATTR=NAME:prio CONTENT=0
TAG POS=1 TYPE=INPUT ATTR=NAME:source CONTENT=imacros
TAG POS=1 TYPE=INPUT ATTR=NAME:file-upload-01 CONTENT=C:\temp\captcha.jpg
TAG POS=1 TYPE=INPUT ATTR=TYPE:submit
WAIT SECONDS=35
TAG POS=1 TYPE=* ATTR=NAME:result EXTRACT=TXT
TAB CLOSE
TAG POS=1 TYPE=INPUT ATTR=ID:adcopy_response CONTENT={{!EXTRACT}}
WAIT SECONDS=5


这是我用来解决SolventMedia验证码的imacros代码。当我运行它时,问题在于它在第5行上找不到标签。如何更改它以复制Solvemedia图像?

另一个错误是当我尝试将其转换为javascript并运行时,它仅在第一个命令中失败

FILEDELETE NAME=c:\temp\captcha.jpg


给我一个错误“ FILEDELETE命令格式错误,第1行(错误代码:910)”

任何帮助表示赞赏:)

最佳答案

我认为您将iMacros与Chrome结合使用,但FILEDELETE则无法实现。见http://wiki.imacros.net/FILEDELETE

您可以将iMacros用于Firefox的示例,也可以将我的完整示例与您的Solvemedia验证码和9kw结合使用:


媒体


SET !EXTRACT_TEST_POPUP NO
SET !ERRORIGNORE NO
SET !TIMEOUT_PAGE 999
SET !TIMEOUT_STEP 999
TAB CLOSEALLOTHERS
'
' Note for users with firefox with the message "Firefox prevented this page from automatically reloading.":
' UNCHECK the option "warn me when pages try to redirect" in your browser
' You find the checkbox under Options > Advanced > General > Accessibility

' Path to the captcha image with timestamp
' Tempfolder like C:\ or C:\TEMP under windows or like /tmp under linux
SET !VAR0 C:\
' Tempfile
SET !VAR1 captcha_{{!NOW:yyyymmdd_hhnnss}}.jpg

' Step 1: Config for 9kw.eu for your apikey
SET !VAR2 your_api_key
'And priority (prio 1-20)
SET !VAR3 0

' Step 2: Save the captcha picture to local disk
TAB T=1
URL GOTO=http://www.solvemedia.com/publishers/captcha-type-in
WAIT SECONDS=3
ONDOWNLOAD FOLDER={{!VAR0}} FILE={{!VAR1}} WAIT=YES
TAG POS=1 TYPE=IMG ATTR=ID:adcopy-puzzle-image-image-profit CONTENT=EVENT:SAVE_ELEMENT_SCREENSHOT

'Wait a random number (1 to 5) of seconds
SET !VAR9 EVAL("Math.floor(Math.random()*5 + 1);")
WAIT SECONDS={{!VAR9}}

'Syntaxcheck: API Key, prio
SET !VAR2 EVAL("var s=\"{{!VAR2}}\"; if(s.match(/^[a-zA-Z0-9]+$/) && s.length <= 50 && s.length >= 5) s; else MacroError(\"API Key is wrong.\")")
SET !VAR3 EVAL("var s=\"{{!VAR3}}\", d = parseFloat(s); if(d >= 0 && d <= 20) d; else MacroError(\"Value(Prio) is not in the set range.\")")

'Step 3: Open the a new tab, and go to 9kw.eu, and submit the captcha picture
TAB OPEN
TAB T=2
URL GOTO=http://www.9kw.eu/grafik/form.html
'The apikey is used to identify each of our customers, which you can get from the our page. It is assigned to the CONTENT.
TAG POS=1 TYPE=INPUT ATTR=NAME:apikey CONTENT={{!VAR2}}
'Priority in our system like min. 0 to max. 20 (cost +0-20)
TAG POS=1 TYPE=INPUT ATTR=NAME:prio CONTENT={{!VAR3}}
'Options for the form. See more under http://www.9kw.eu/grafik/form.html and http://www.9kw.eu/api.html
TAG POS=1 TYPE=INPUT:CHECKBOX FORM=ACTION:/index.cgi ATTR=NAME:selfsolve CONTENT=NO
TAG POS=1 TYPE=INPUT:CHECKBOX FORM=ACTION:/index.cgi ATTR=NAME:confirm CONTENT=NO
TAG POS=1 TYPE=INPUT:CHECKBOX FORM=ACTION:/index.cgi ATTR=NAME:case-sensitive CONTENT=NO
'TAG POS=1 TYPE=INPUT:CHECKBOX FORM=ACTION:/index.cgi ATTR=NAME:nomd5 CONTENT=YES
TAG POS=1 TYPE=INPUT ATTR=NAME:source CONTENT=imacros
'The path of the captcha picture saved is assigned to the CONTENT
TAG POS=1 TYPE=INPUT ATTR=NAME:file-upload-01 CONTENT={{!VAR0}}{{!VAR1}}
'Submit the formdata to 9kw.eu
TAG POS=1 TYPE=INPUT ATTR=TYPE:submit
'Extract the captchaid from your captcha submit
TAG POS=1 TYPE=INPUT ATTR=NAME:captchaid EXTRACT=TXT
SET !VAR5 {{!EXTRACT}}
'Clean the !EXTRACT variable for the next task
SET !EXTRACT NULL
'Extract the characters that are recoginzed from the picture of captcha.
TAG POS=1 TYPE=INPUT ATTR=NAME:result EXTRACT=TXT
TAB CLOSE
TAB T=1

'Display extracted data (only for debug)
'PROMPT {{!VAR5}}

'Step 4: Check the captcha answer (text or nothing like #EANF# = Extraction Anchor Not Found)
SET !VAR6 EVAL("if (\"{{!EXTRACT}}\" == \"#EANF#\") {var x = \"\";} else {var x = \"{{!EXTRACT}}\";} x;")
'Clean the !EXTRACT variable for the next task
SET !EXTRACT NULL

'Step 5: Fill the recognized characters to the verification box
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:demo_form ATTR=ID:adcopy_response-profit CONTENT={{!VAR6}}
WAIT SECONDS=5
TAG POS=1 TYPE=DIV ATTR=ID:verify_profit
WAIT SECONDS=4

'Step 6: Check and send the captcha feedback back to the captcha service (OK:1, NotOK:2, EN: Right/False, DE: Richtig/Falsch)
'SEARCH SOURCE=REGEXP:"greencheck.png\" style=\"display: ([^;]+);" IGNORE_CASE=YES EXTRACT="$1"
TAG POS=1 TYPE=IMG ATTR=ID:profit-correct EXTRACT=HTM
SET !VAR7 {{!EXTRACT}}
SET !EXTRACT NULL
SET !VAR8 EVAL("if ('{{!VAR7}}'.match(/style=\"display: block/)) {var x = \"1\";} else {var x = \"2\";} x;")
TAB OPEN
TAB T=2
URL GOTO=http://www.9kw.eu/index.cgi?source=imacros&action=usercaptchacorrectback&apikey={{!VAR2}}&correct={{!VAR8}}&id={{!VAR5}}
WAIT SECONDS=2
TAB CLOSE
TAB T=1

'Cleanup: Delete the old captcha picture
FILEDELETE NAME={{!VAR0}}{{!VAR1}}

10-04 19:50