views:

19

answers:

1

Hye everybody

I'm here to get some help on a problem. Currently I'm working on a login web page which gives alerts and confirm on submitting the user details, I had to automate the login through java. As I had tried my hand on many othe web pages earlier with gargoyle API through code which worked well for other things but now got stuck with the alert confirm handling which are written in a javascript fired by the submit button when clicked and next page load only if the javascript executes all the conditions to true. I googled and tried the alert handler functions and other things provided by gargoyle and played around with it to get to know how it works but still having no luck with it so kindly suggest any possible solution or link (best if some example code) which can be used direclty in java code. Thanks for reading.

regards

Coding Jason

A: 

Hye everybody

I'm answering this question myself as I didn't found any solution for alert handling part in gargoyle but managed with other things available in it. What I done for this is that I manually executed the java scripts which were getting fired at the time of click of the submit button of the form by coping their source code and manually executing them (syntax mentioned below if needed) on the HtmlPage and then getting the resultant page. One should notice that if the script executed successfully will return resultant page otherwise the same page. This is mentioned in the online gargoyle API documentation also. That is finally you can skip the whole alerts and confirm part in the loaded page but you had to deal with the java script at form submit or request making time and I dealt with it by executing them. I'll be waiting for a better answer for dealing with alert handling on HtmlPage of gargoyle.

-------------------------------------Code written for problem-----------------------------

<Code for setting values to inputs in the form>
...
ScriptResult newResult = loginPage.executeJavaScript("<some javascript1>; <some javascript2>;...");
HtmlPage newPage = (HtmlPage) newResult.getNewPage();

----------------------------------------------------------------------------------------------

regards

la_89ondevg

la89ondevg
This answer is a kind of quick fix but not a proper answer so use it if you are in a hurry
la89ondevg