Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About aircooled

  • Rank
  1. This statement solved the problem: ie.document.getElementById("application").contentDocument.getElementById("USERNAME.DUMMY.DUMMY").value := "Mary" 😍 😍
  2. Thanks dsonesuk. 1) Could you please clarify which code you refer to that is browser specific and what problem it implies for implementing in AHK.. 2)THE ELEMENT WITH name="USERNAME.DUMMY.DUMMY" has id="USERNAME.DUMMY.DUMMY" I have not changed or added anything.
  3. You are totally correct, dsonesuk it should be || iframevar Funny thing is it works fine with iframe in Chrome console. Could be that it retrieves from iframevar.contentDocument and ignores iframe.contentWindow.document (wrong) However. Added semicolons and corrected iframe -> iframevar and it doesn't work from AutoHotKey while it continues to work fine from Chrome Console I have converted to a oneliner that works in console (which proves why it worked with iframe iso iframevar) but not from AutoHotKey: document.getElementById("application").contentDocument.getElementById("USERNAME.DUMMY.DUMMY").value = "Hello"
  4. I have found the solution. The field was inside a frame and now it works fine in Chrome Console. var iframevar = document.getElementById("application") var innerDoc = iframevar.contentDocument || iframe.contentWindow.document innerDoc.getElementById("USERNAME.DUMMY.DUMMY").value = "hello" However I cannot make it to work from my calling environment. Is there a way to consolidate the 3 lines above to 1 line? PS: I am calling JavaScript from AutoHotKey. It doesn't work in AHK I suspect because lines are executed before the prior line is completed. What is the easieast way to wait until a command is completed before continuing?
  5. The problem here is that I SUCCEED inserting in some websites and with the same login not in others. In Chrome console it requires := but executing from another very special software at my work it accepts both. Forget about "=" or ":=" in the sites i fail to update it works with neither. In the sites that I SUCCEED I do it with both from my software and only with ":=" in Chrome Console. Please read the source code in my first message and help me with a command to populate the uid field as well as the pwd field. Thank you very much.
  6. Is there a record/play HTML JavaScript sofware? I just want to record very limited actions like click on a webpage's field and insert a name and have the software recording (just as an exmple): document.getElementsByClassName("inline")[1].value := "Mary" Much like it is possible with a Selenium framework on the exact same website. The Selenium framework recorder extracts all attributes of the webobject (id, name, xpath, css, etc) and chooses one that it finds more appropriate while it displays all of them. If I find as a user that I want to use another attribute instead since I find it more suitable, I change the software's choice and change to my choice. I am having problems automating a website with JavaScript (none of the function calls I use based on an inspect with Google Dev Tools work) while I can perfectly interact with the same website fields by executing Selenium. Anyone knows of such a record/play HTML JavaScript software?
  7. It works perfect with ':=' on the sites I succeeded with. I am calling Java script from other software could be that. But it works.
  8. I am new to Javascript have googled and can't solve this problem, need help. Have automated several flows in websites without problems but in this specific site I can't even get the uid/pwd fields or the login button to react to Javascript. Here what I tried for the uid field document.getElementsByClassName("inline")[1].value := "Mary" document.getElementsByClassName("inline")[0].value := "Mary" document.getElementsByName("USERNAME.DUMMY.DUMMY.1")[0].value := "Mary" document.getElementsByName("USERNAME.DUMMY.DUMMY.1")[1].value := "Mary" document.getElementById("namedata").value := "Mary" The same for the pwd field to no avail. With a Selenium framework there is no problem to insert data in the fields and click to the Login button and repository objects are created with attributes name and id. Can't understand why using the same attributes Java script can't access the fields or the button. Here the attributes retrieved by the Selenium Framework. https://postimg.cc/DWBrxGxP I inspect that specific element with Chrome's DevTools and use the class/name/id there or choose "Copy selector" in its context menu and use document.Queryselector. No success at all. Here the complete HTML code of the page. What is going on, why can't I in this specific site write to uid and /or pwd fields? <!DOCTYPE html> <html><!-- Arhettan Startup Screen --><head> <meta http-equiv="content-type" content="text/html; charset=windows-1252"> <meta http-equiv="Pragma" content="no-cache"> <meta http-equiv="CACHE-CONTROL" content="no-cache"> <meta http-equiv="Expires" content="0"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <title>Arhettan On The Web</title> <style type="text/css"> HTML,BODY { /* The styles on the body element here prevent IE form showing a greyed-out vertical scroll bar on the browser window at all times. */ width: 100%; height: 100%; overflow: auto; } IFRAME { width: 100%; height: 100%; position: absolute; } </style> <script type="text/javascript"> var appBodyClassName="SKINNED"; var newlogincss = '../../kmdnatrium/login_kmd1.css'; var customBranding = {'welcomeURL':'../../kmdnatrium/kmdnatrium.html'}; var newloginhtml = '<img src="../../kmdnatrium/images/login/Login_background_kmd.jpg" class="bg"><div align=center valign=middle class="login-center-transparent">\ <div class="login-top-left">\ <div class="container">\ <span class="password"><div class="inline" id="usernametext"></div> </span><div class="inline" id="namedata"><X-SUBST type="text" name="USERNAME.DUMMY.DUMMY" class="form" autocomplete="Off"></X-SUBST></div>\ <br>\ <span class="password"><div class="inline" id="pwdtext"></div> </span><div class="inline" id="pwddata"><X-SUBST type="text" name="PASSWORD.DUMMY.DUMMY" class="form" autocomplete="Off"></X-SUBST></div>\ <br>\ <span>\ <div class="rememberme">\ <div class="inline" id="remembertext"></div>\ <div class="inline" id="rememberdata"><X-SUBST type="checkbox" name="REMEMBER_ME.DUMMY.DUMMY" autocomplete="Off"></X-SUBST></div> \ </div>\ <div class="loginbutton" id="submitdata">\ <X-SUBST type="text" name="ATTEMPT.DUMMY.DUMMY" class="form"></X-SUBST>\ <X-SUBST type="submit" name="LOGIN.DUMMY.DUMMY" src="../../generic/images/login/Logo_for_phase_1_kmd.jpeg"><INPUT type="submit" name="LOGIN.DUMMY.DUMMY" value="Click Here to Login"></X-SUBST>\ </div>\ </span>\ </div>\ </div>\ <div class="login-top-right">\ <div class="img">\ </div>\ </div>\ <div class="login-bottom">\ <div id="MESSAGEBOARD"></div>\ <div id="loginLinkContainer" style="float:left">\ </div>\ <div class="login-bottom-info">\ +45 44 605 722 <b>|</b> <a href="mailto:natriumsupport@kmd.tu">natriumsupport@kmd.tu</a> <b>|</b> <a href="www.kmd.tu">www.kmd.tu</a>\ </div>\ <div class="login-version-text" id="versiontext"></div>\ </div>\ </div>'; if(top != window){ top.location = window.location.href; } function getWindowState(){var g=this,f={scrollLeft:NaN,scrollTop:NaN},j={clientWidth:NaN,clientHeight:NaN},k={innerWidth:NaN,innerHeight:NaN},l='scrollLeft',m='scrollTop',n=0,p,q,r,s,u=null,v=null, o={getScrollX:x,getScrollY:y,getWidth:function(){return I('getWidth');},getHeight:function(){return I('getHeight');}};function X(){J();return x();}function Y(){J();return q;}function x(){return f[l]|0;}function y(){return f[m]|0;}function W(){return k.innerWidth;}function w(){return j.clientWidth;}function H(){return k.innerHeight;}function h(){return j.clientHeight;}function U(){return(F()?o.getHeight:h)();}function V(){return (F()?o.getWidth:w)();}function D(){o.getWidth=W;o.getHeight=H;}function E(){o.getScrollX=x;o.getScrollY=y;}function F(){if((s!=(s=H()))||(r!=(r=W()))){R();return true;}return false;}function J(){if((q!=(q=y()))||(p!=(p=x()))){R();}}function K(a,b){var V,H;if(((V=(g.innerHeight-a.clientHeight))>=0)&&((H=(g.innerWidth-a.clientWidth))>=0)&&(!(x()&&!V))&&(!(y()&&!H))&&(!((H&&(b.h||(b.h=H))&&(H!=b.h))||(V&&(b.v||(b.v=V))&&(V!=b.v))))){if(H==V){b.r=(+Boolean(H));}else if((H&&!V)||(V&&!H)){b.r=(H+V);}else{b.r=NaN;}}else{b.r=NaN;}return b;}function P(t){for(var c=arguments.length;--c;){if(typeof t[arguments[c]]!='number'){return false;}}return true;}function Q(a,b){if(a&&P(a,'clientWidth','clientHeight')){K(a,b);}return b;}function I(c){r=W();s=H();q=y();p=x();u={v:0,h:0,r:NaN};v={v:0,h:0,r:NaN};o.getWidth=V;o.getHeight=U;o.getScrollX=X;o.getScrollY=Y;R();Q=K;return o[c]();}function R(){var c=document,b=isNaN(Q(c.body,u).r),d=isNaN(Q(c.documentElement,v).r);if(b||d){if(b&&d){E();D();}else{j=((d)?c.body:c.documentElement);u=((d)?u:v);v=null;R=T;}}else{j=((u.r < v.r)?c.body:c.documentElement);}}function T(){if(isNaN(Q(j,u).r)){u=null;E();D();}else if((u.v)&&(u.h)&&(++n > 2)){u=null;o.getWidth=w;o.getHeight=h;E();}}if(!P(g,'innerHeight','innerWidth')){j=compatModeTest(j);o.getWidth=w;o.getHeight=h;}else{k=g;}if(P(g,'pageYOffset','pageXOffset')){f=g;m='pageYOffset';l='pageXOffset';}else{f=compatModeTest(f);}return(getWindowState=function(){return o;})();} function compatModeTest(o){var d=document;if((d.compatMode)&&(d.compatMode.indexOf('CSS')!=-1)&&(d.documentElement)){return (compatModeTest=function(){return d.documentElement;})((o=null));}else if(d.body){return (compatModeTest=function(){return d.body;})((o=null));}else{return o;}} </script> </head> <body topmargin="0" marginwidth="0" marginheight="0" leftmargin="0"> <div style="position: absolute; bottom: 0px; background-color: #888888; width: 100%; padding: 0px; margin: 0px;"> <select id="messageBox" style="width: 100%; padding: 0px; margin: 0px; border: 0px none #888888;"> <option selected="selected"></option> <option></option> <option></option> <option></option> </select> </div> <script language="JAVASCRIPT" src="natriumkmd_files/Arhettan.js"></script><iframe name="application" id="application" marginheight="0" marginwidth="0" src="natriumkmd_files/SPDEMLOGIN.htm" width="100%" height="100%" frameborder="0"></iframe> </body></html> Any help will be highly appreciated thanks in advance.
  • Create New...