Jenkins1-jenkins自动登陆

http://10.103.3.235/j_acegi_security_check?j_username=xiuju_lan&j_password=xxxx&from=/job/A7_autoCase

通过phantom来自动登陆并截图

 

var page = require('webpage').create();
page.open('http://10.103.3.235/login?from=/job/A7_autoCase/', function() {
        page.evaluate(function() {
    window.document.getElementsByName("j_username")[0].value="xiuju_lan"
    window.document.getElementsByName("j_password")[0].value="xxx"
    window.document.getElementById("yui-gen1-button").click();
        });
window.setTimeout(function () {
page.clipRect = { left: 5, top: 30, width: 1600, height: 800 };
page.render('jenkins.png');
phantom.exit();
}, 20000 );
});

 

posted @ 2016-08-31 14:24  禾米  阅读(418)  评论(0编辑  收藏  举报