Reputation: 63
I need help with iMacros.
I have a task which consists of two parts:
1) Go to a website and fill out a form.
URL GOTO=https://example.com/registration
TAG POS=1 TYPE=INPUT:TEXT ATTR=ID:NQKtn CONTENT=ggg
2) Check if the text Mytext
exists (which has to appear after filling out the form).
The task of the script is to save the string ggg
to file.txt
if the text is found, and to pass it if it's not.
How can I solve this problem? Thanks very much!
Upvotes: 0
Views: 3835
Reputation: 102
Example with Javascript and iMacros for Firefox:
var FilePath = "c:\\yourfile.txt";
var your_newtext = "ggg";
var macro = "CODE:";
macro += "URL GOTO=https://example.com/registration\n";
macro += "SET !ERRORIGNORE YES\n";
macro += "TAG POS=1 TYPE=INPUT:TEXT ATTR=ID:NQKtn CONTENT="+your_newtext+"\n";
macro += "WAIT SECONDS = 0.1\n";
macro += "TAG POS=1 TYPE=INPUT:TEXT ATTR=ID:NQKtn EXTRACT=TXT\n";
iimPlay(macro);
var last_extract = iimGetLastExtract();
var msg;
if(last_extract == "#EANF#" || last_extract == ""){
msg = "NOT FOUND\n";
}else{
msg = "FOUND: "+last_extract+"\n";
}
var file_o = imns.FIO.openNode(FilePath);
imns.FIO.appendTextFile(file_o, msg);
Upvotes: 2