使用iMacro填写具有随机名称的字段 [英] Fill up fields with random names with iMacro
问题描述
我目前在Firefox上使用iMacro来快速填写带有随机字母的表格.
I currently use iMacro for Firefox for quick form filling with random letters.
SET !VAR1 EVAL("var letters = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','w','x','y','z']; var string = ''; for(var i = 0; i < 11; i++){string += letters[parseInt(Math.random() * 25)]}; string")
EVENT TYPE=CLICK SELECTOR="#namex" BUTTON=0
EVENTS TYPE=KEYPRESS SELECTOR="#namex" CHARS="{{!var1}}"
结果例如adionudmeai
.
我有一个文本文件,其中包含 十万个这种格式的名字.
I have a text file that containing one hundred thousand names in this format.
johny.hunter
tim.davies
emil.bernadette
我要使用此名称而不是随机组合 最后还有两个随机数.
I want to use this names instead of the random combinations with two additional random numbers at the end.
最终结果应类似于bill.cayne32
.
推荐答案
I使用文本/csv文件中的预生成字符串(可以手动生成,也可以由随机名称生成器"在线生成). 生成一个file.csv,其中每一行包含一个用户的逗号分隔信息.对于第一项,信息以{{!COL1}}的形式访问,对于第二项,信息以2的形式访问,等等. 使用此csv方法可让您拆分名字/姓氏,并将其用于信息填充和所需的用户名,并在两者之间使用句点.
I Use pre-generated strings from a text/csv file (Can be generated manually or by a 'random name generator' online). Generate a file.csv where each line holds comma seperated info for one user. Info is accessed as {{!COL1}} for first item, 2 for second item etc'. Using this csv method allows you to split first/last names and use them for both info filling and for the desired username with a period in between.
SET !DATASOURCE C:\Temp\stackoverflow.csv
SET !LOOP 1337 'where to start in the csv file
SET !DATASOURCE_LINE {{!LOOP}}
EVENTS TYPE=KEYPRESS SELECTOR="#new_post>DIV>P>DIV>DIV" CHARS={{!COL1}}{{!COL2}}.{{!COL3}}{{!VAR1}}
stackoverflow.csv文件示例:
stackoverflow.csv file example:
pika,chuu,easypassword123
wobbu,ffet,mypassword
chari,zard,123456
在{{!COL1}}之后,您可以插入随机的{{!VAR1}}或仅插入{{!LOOP}}(如果它不一定是真正的随机数).
after {{!COL1}} you can insert your random {{!VAR1}} or just {{!LOOP}} if it doesn't have to be real random.
要让VAR1显示数字而不是字符,请执行以下操作:
To get VAR1 to display numbers and not chars do:
SET !VAR1 EVAL("var letters = ['1','2','3','4','5','6','7','8','9','0']; var string = ''; for(var i = 0; i < 2; i++){string += letters[parseInt(Math.random() * 10)]}; string")
这篇关于使用iMacro填写具有随机名称的字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!