开发者

timed click on a web form

I'd like to automate the clicking of a web-form button, in order that the web form "submit" button be pressed at a certain time. If possible, I'd like to do this on Firefox on a Mac, but I'm open to alternatives.

It's not obvious how to do this with Applescript or Mac's Automator. I have some experience with VUgen from Mercury Interactive / HP, but AFAIrecall that's a paid-for tool, supporting IE on Windows. I have an idea that it might be possible using Javascript, but I'm uncertain where I'd instantiate the Javascript, in order to click the button开发者_开发技巧.


I have looked a little bit at the bookmarklet idea I gave you and here is a jsfiddle with at the very least some starting code

http://jsfiddle.net/FGM9j/2/

<input type="submit" id="test" onclick="alert('worked')"></input>
function timerPassed()
{
    alert('timer'); //to show timer works
    document.getElementById('test').click();

}
window.setTimeout(timerPassed,3000);//function you want to call , time in milliseconds

Also certain input types cannot be run via javascript just as file. The resulting bookmark would look something like:

  javascript:function timerPassed(){document.getElementById('test').click();}window.setTimeout(timerPassed,3000);

setInterval in place of setTimeout could be used instead if you wanted it to repeat the process, for example if things needed to meet a certain specification before the button was to be clicked.


There are two existing framework which can make automate test web, web form is one of many things them can do, try to look:

  • http://seleniumhq.org/
  • http://www.iopus.com/imacros/

You can use it as web browser extension/addons or standalone framework with support programmable scripting.

Good luck!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜