Support Request: Script help

Description

In regards to devblog: http://devblog.provisio.com/post/2016/06/22/Using-the-SiteKiosk-Object-Model-for-Automated-Website-Logins.aspx
We had this script working some time ago, but then the submit button was not longer getting activated. The user name and password are getting put in, but then it doesn't continue on. I'm wondering if someone there might have a quick answer. I've been through the forum, dev blogs and google searches, but just can't seem to find a solution. I've included a screen shot of the web page properties. (I know this probably isn't a support issue, but grasping at straws to see if someone might have some suggestions). Thanks!

The script is as follows:

//Message event used to detect navigation to login page
SiteKiosk.Logfile.OnMessage = OnMessage;
function OnMessage(seq, time, utcoff, awtype, awlevel, facility, text)
{
//Check the SiteKiosk logs if the login page has been called and then call the function to attempt the automated login
if(text.indexOf("Navigation: ") !== -1 && text.indexOf("https://prdodypub.courts.wa.gov/ODYPORTAL/Account/login/index.html") !== -1)
{
//Delays the automatic login to give the page time to load
evtid = SiteKiosk.Scheduler.AddDelayedEvent(3500, AutomaticLogin);
}
}

function AutomaticLogin()
{
//Go through the open windows to find the browser window with the login page
for (var i=1;i<=SiteKiosk.WindowList.Windows.Count;i++)
{
//Make sure the window is a SiteKiosk browser window and it displays the login page
if (SiteKiosk.WindowList.Windows(i).WindowType === 1 || SiteKiosk.WindowList.Windows(i).WindowType === 2)
{
SiteKiosk.Logfile.Notification("------ Found the open window and Adding the data to the text boxes.");
SiteKiosk.WindowList.Windows(i).SiteKioskWindow.SiteKioskWebBrowser.WebBrowser.Document.getElementById('UserName').value = "sclody(at)somewhere.org";
SiteKiosk.WindowList.Windows(i).SiteKioskWindow.SiteKioskWebBrowser.WebBrowser.Document.getElementById('Password').value = "NotTheRealPassword";

var inputs = SiteKiosk.WindowList.Windows(i).SiteKioskWindow.SiteKioskWebBrowser.WebBrowser.Document.getElementsByTagName("BUTTON");
for (var i=0; i < inputs.length; i++)
{
if (inputs[i].getAttribute('type') == 'submit')
{
inputs[i].click();
}
}
}
}

}

Answer: (1)

Re: Script help 8/6/2021 9:11 PM
Hello,

Thank you for your inquiry. Please note that customization of coding is not included with our free support. However, I can explain the other solutions provided in Developers Blog. Before I do that, there maybe some websites that prevent automated scripts from making DOM changes. You will need to email us [ support-america(at)provisio.com ] or consult a Web Developer for another solution if these below, do not work.

First, check to see if your example behaves differently with IE vs Chrome in SiteKiosk. Since most companies are switching to Chrome browser and also assuming that you will be using the Chrome Browser inside SiteKiosk, here are other solutions:

JavaScript only -
By including your JavaScript code in this blank file ( C:\Program Files (x86)\SiteKiosk\SiteKioskNG\assets\customScriptExtension.js ), you can manipulate any HTML element as you see fit on any website you need. You will not need to know any SiteKiosk Object Model commands. See link for more:
https://devblog.provisio.com/post/2019/05/17/Manipulating-the-DOM-within-the-SiteKiosk-Windows-Chrome-Browser.aspx

JavaScript (a bit SK Object Model) and WScript (for keyboard commands) (Works with IE) -
This solution still uses JavaScript but instead of manipulating page elements, it simulates keyboard actions through Wscript. You can read more here:
https://devblog.provisio.com/post/2017/10/19/Using-the-External-Script-Option-of-SiteKiosk-to-Automate-Processes.aspx

This link is in the instructions above but I would like to point them out here (for other special keyboard key presses like TAB and others):
https://social.technet.microsoft.com/wiki/contents/articles/5169.vbscript-sendkeys-method.aspx

Best regards,
Andre.
My Account
Login
Search
Search