I have a XOJO web app.
One of the web pages in my app contains a WebHTMLViewer which on ‘open’ loads an external website.
User credentials in my app and the external website are the same for each user.
My aim is to login to the site contained in the WebHTMLViewer on behalf of the user by completing and submitting a login form.
So once the page is loaded in the browser, I (from a button action) try just to complete a single field (just to test the process):
HTMLViewer1.ExecuteJavaScript(“document.getElementById(‘sign-in-email’).value = ‘example_user@exampledomain.com’;”) and several other variations which all result in error.
“Could not execute returned javascript: Unable to set property ‘value’ of undefined or null reference” or similar errors indicating I cannot access the DOM of the page in the WebHTMLViewer.
I am guessing this is an XSS (cross site scripting) issue.
I have two questions then.
1, is my aim still achievable with ExecuteJavaScript (perhaps utilising some secondary JS technique); and (if that is not possible),
2. is it possible to automate by simulating Click and KeyPressed events in the WebHTMLViewer.
The external website might have url based forms to login. Then you could request right into the login “form” so to speak by loading a url with query parameters. Perhaps you can give the url of the website you are trying to login to.