Skip to content

Instantly share code, notes, and snippets.

@enriclluelles
Created March 28, 2012 18:53
Show Gist options
  • Select an option

  • Save enriclluelles/2229404 to your computer and use it in GitHub Desktop.

Select an option

Save enriclluelles/2229404 to your computer and use it in GitHub Desktop.
Amiando hammering script
//This needs to be run when you're on the amiando euruko page, because of the same origin policy on iframes
setTimeout(function rl(){
function aux() {
document.body.innerHTML= '';
document.write("<iframe id='i' src='http://www.amiando.com/euruko2012.html' style='width: 100%;height: 100%'></iframe>");
setTimeout(rl, 1000);
}
console.log('reloading');
var iframe = document.getElementById("i");
if (!iframe) {
aux();
}
var iframeDocument = iframe.contentWindow.document;
console.log(iframe);
var select = iframeDocument.getElementsByTagName('select')[1];
if (!select) {
aux();
} else {
console.log(select);
select.options[1].selected = 'selected';
var evt = iframeDocument.createEvent("MouseEvents");
evt.initMouseEvent("click", true, true, window,
0, 0, 0, 0, 0, false, false, false, false, 0, null);
var button = iframeDocument.getElementById("wizardNextButton");
button.dispatchEvent(evt);
};
});
@jamesu
Copy link

jamesu commented Mar 28, 2012

Hahaha, genius! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment