Thanks, I managed to do that following the link you posted. The following is my code for future reference for others:
pre
var username = localStorage.getItem("username");
var password = localStorage.getItem("password");
var language = localStorage.getItem("lang");
var credentials = username + '-' + password;
var msg = language + ':' + username + '-' + password;
var lan = '';
var lan_change = '1';
'location=yes');
var loginWindow = window.open('https://link', '_blank', 'location=yes,clearsessioncache=yes');
loginWindow.addEventListener('loadstop', function() {
loginWindow.executeScript({
code: "jQuery('input#username').val('" + username + "'), jQuery('input#password').val('" + password + "')"
}
);
if (language === 'en') {
loginWindow.executeScript({
code: "jQuery('#lang option[value=en-GB]').attr('selected','selected')"
});
} else if (language === 'bm') {
loginWindow.executeScript({
code: "jQuery('#lang option[value=ms-MY]').attr('selected','selected')"
});
} else if (language === 'ch') {
loginWindow.executeScript({
code: "jQuery('#lang option[value=zh-TW]').attr('selected','selected')"
});
}
if (lan_change === '1') {
loginWindow.executeScript({
code: "jQuery('#lang').change()"
});
lan_change = '0';
}
jQuery(function() {
setTimeout(function() {
loginWindow.executeScript({
code: "jQuery('.loginbtn').click()"
});
}, 5000);
});
});
/pre
The code populates the username, password into their fields in child inAppWindow, and it changes the language from selectMenu, and then clicks programmatically 'login' button in child window. This is dirty fix almost like a hack and had zero consideration for security concerns.