Changeset 1823


Ignore:
Timestamp:
11/13/14 15:25:23 (10 years ago)
Author:
pharms
Message:
  • extended and corrected logging, e.g., of scrolling and submitting forms using the enter key
Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/autoquest-htmlmonitor-test/src/test/resources/test.html

    r1244 r1823  
    4545      </tr> 
    4646      <tr> 
     47        <td class="label">combo box</td> 
     48        <td> 
     49          <select> 
     50            <option>ScrolltestScrolltestScrolltestScrolltest1</option> 
     51            <option>ScrolltestScrolltestScrolltestScrolltest2</option> 
     52            <option>ScrolltestScrolltestScrolltestScrolltest3</option> 
     53            <option>ScrolltestScrolltestScrolltestScrolltest4</option> 
     54            <option>ScrolltestScrolltestScrolltestScrolltest5</option> 
     55            <option>ScrolltestScrolltestScrolltestScrolltest6</option> 
     56            <option>ScrolltestScrolltestScrolltestScrolltest7</option> 
     57            <option>ScrolltestScrolltestScrolltestScrolltest8</option> 
     58            <option>ScrolltestScrolltestScrolltestScrolltest9</option> 
     59            <option>ScrolltestScrolltestScrolltestScrolltest10</option> 
     60            <option>ScrolltestScrolltestScrolltestScrolltest11</option> 
     61            <option>ScrolltestScrolltestScrolltestScrolltest12</option> 
     62            <option>ScrolltestScrolltestScrolltestScrolltest13</option> 
     63            <option>ScrolltestScrolltestScrolltestScrolltest14</option> 
     64            <option>ScrolltestScrolltestScrolltestScrolltest15</option> 
     65            <option>ScrolltestScrolltestScrolltestScrolltest1</option> 
     66            <option>ScrolltestScrolltestScrolltestScrolltest2</option> 
     67            <option>ScrolltestScrolltestScrolltestScrolltest3</option> 
     68            <option>ScrolltestScrolltestScrolltestScrolltest4</option> 
     69            <option>ScrolltestScrolltestScrolltestScrolltest5</option> 
     70            <option>ScrolltestScrolltestScrolltestScrolltest6</option> 
     71            <option>ScrolltestScrolltestScrolltestScrolltest7</option> 
     72            <option>ScrolltestScrolltestScrolltestScrolltest8</option> 
     73            <option>ScrolltestScrolltestScrolltestScrolltest9</option> 
     74            <option>ScrolltestScrolltestScrolltestScrolltest10</option> 
     75            <option>ScrolltestScrolltestScrolltestScrolltest11</option> 
     76            <option>ScrolltestScrolltestScrolltestScrolltest12</option> 
     77            <option>ScrolltestScrolltestScrolltestScrolltest13</option> 
     78            <option>ScrolltestScrolltestScrolltestScrolltest14</option> 
     79            <option>ScrolltestScrolltestScrolltestScrolltest15</option> 
     80            <option>ScrolltestScrolltestScrolltestScrolltest1</option> 
     81            <option>ScrolltestScrolltestScrolltestScrolltest2</option> 
     82            <option>ScrolltestScrolltestScrolltestScrolltest3</option> 
     83            <option>ScrolltestScrolltestScrolltestScrolltest4</option> 
     84            <option>ScrolltestScrolltestScrolltestScrolltest5</option> 
     85            <option>ScrolltestScrolltestScrolltestScrolltest6</option> 
     86            <option>ScrolltestScrolltestScrolltestScrolltest7</option> 
     87            <option>ScrolltestScrolltestScrolltestScrolltest8</option> 
     88            <option>ScrolltestScrolltestScrolltestScrolltest9</option> 
     89            <option>ScrolltestScrolltestScrolltestScrolltest10</option> 
     90            <option>ScrolltestScrolltestScrolltestScrolltest11</option> 
     91            <option>ScrolltestScrolltestScrolltestScrolltest12</option> 
     92            <option>ScrolltestScrolltestScrolltestScrolltest13</option> 
     93            <option>ScrolltestScrolltestScrolltestScrolltest14</option> 
     94            <option>ScrolltestScrolltestScrolltestScrolltest15</option> 
     95          </select> 
     96        </td> 
     97      </tr> 
     98      <tr> 
    4799        <td class="label"></td> 
    48         <td><input type="button" value="Daten abschicken" onclick="sendRequest();" /></td> 
     100        <td><input type="submit" value="Daten abschicken" onclick="sendRequest();" /></td> 
    49101      </tr> 
    50102    </table> 
    51103  </form> 
     104  <div style="width: 200px; height: 200px; overflow: auto;"> 
     105    ScrolltestScrolltestScrolltestScrolltest 
     106    ScrolltestScrolltestScrolltestScrolltest 
     107    ScrolltestScrolltestScrolltestScrolltest 
     108    ScrolltestScrolltestScrolltestScrolltest 
     109    ScrolltestScrolltestScrolltestScrolltest 
     110    ScrolltestScrolltestScrolltestScrolltest 
     111    ScrolltestScrolltestScrolltestScrolltest 
     112    ScrolltestScrolltestScrolltestScrolltest 
     113    ScrolltestScrolltestScrolltestScrolltest 
     114    ScrolltestScrolltestScrolltestScrolltest 
     115    ScrolltestScrolltestScrolltestScrolltest 
     116    ScrolltestScrolltestScrolltestScrolltest 
     117    ScrolltestScrolltestScrolltestScrolltest 
     118    ScrolltestScrolltestScrolltestScrolltest 
     119    ScrolltestScrolltestScrolltestScrolltest 
     120    ScrolltestScrolltestScrolltestScrolltest 
     121    ScrolltestScrolltestScrolltestScrolltest 
     122    ScrolltestScrolltestScrolltestScrolltest 
     123    ScrolltestScrolltestScrolltestScrolltest 
     124    ScrolltestScrolltestScrolltestScrolltest 
     125    ScrolltestScrolltestScrolltestScrolltest 
     126  </div> 
    52127</body> 
    53128</html> 
  • trunk/autoquest-htmlmonitor/src/main/js/autoquest-htmlmonitor.js

    r1807 r1823  
    228228    //{ "tag": "section", "actions": [  ] }, 
    229229    { "tag": "select", "actions": [ "onchange", 
    230                                     "onfocus" ] }, 
     230                                    "onfocus", 
     231                                    "onscroll" ] }, 
    231232    { "tag": "small", "actions": [ "onclick" ] }, 
    232233    //{ "tag": "source", "actions": [  ] }, 
     
    303304            addDefaultEventHandling(); 
    304305             
     306            // the onload event is already fired and lost. So pretend it to happen. 
     307            handleEvent(document.getElementsByTagName("body").item(0), "onload", 
     308                        "/html[0]/body[0]", null); 
     309             
    305310            // recall sending data each 100 seconds to ensure, that for browser windows staying 
    306311            // open the data will be send, as well. 
     
    588593    var eventType; 
    589594    var eventObj = null; 
     595    var preceedingScrollEventObj = null; 
    590596    var tagName; 
    591597    var unmonitored; 
     598    var x1, x2; 
     599    var y1, y2; 
    592600 
    593601    if (!autoquestDestination) { 
     
    603611    if ((eventType === "onkeydown") && (node === document.body)) { 
    604612        // do not handle key downs on the body which are other than tabs (keycode 9) 
    605         if (event.keyCode !== 9) { 
     613        if ((event.keyCode !== 9) && (event.keyCode !== 13)) { 
    606614            return; 
    607615        } 
     
    613621        eventObj = autoquestRecordedEvents[autoquestRecordedEvents.length - 1]; 
    614622 
    615         if ((eventObj.type === eventName) && (eventObj.nodePath.indexOf(nodePath) === 0)) { 
     623        if ((eventObj.type === eventType) && (eventObj.nodePath.indexOf(nodePath) === 0)) { 
    616624            // the event is of the same type. 
    617625            if (eventObj.nodePath.length > nodePath.length) { 
     
    623631            } 
    624632            else if (eventType !== "onscroll") { 
    625                 // we have the same event on the same element. If it is an onscroll, we should 
     633                // we have the same event on the same element. If it is an onscroll, we may 
    626634                // reuse it. But it is not an onscroll. So we ignore the existing event. 
    627635                eventObj = null; 
     636            } 
     637            else { 
     638                // we have a repeated onscroll. Check, if the scrolling direction can be determined 
     639                // and if it changed. If so created a new object. If not, stick to the existing one. 
     640                if (autoquestRecordedEvents.length > 1) { 
     641                    preceedingScrollEventObj = 
     642                        autoquestRecordedEvents[autoquestRecordedEvents.length - 2]; 
     643                     
     644                    if (preceedingScrollEventObj.type !== eventType) { 
     645                        preceedingScrollEventObj = null; 
     646                    } 
     647                } 
     648                 
     649                if (preceedingScrollEventObj != null) { 
     650                    x1 = preceedingScrollEventObj.scrollPosition[0] - eventObj.scrollPosition[0]; 
     651                    x2 = eventObj.scrollPosition[0] - getScrollCoordinates(node)[0]; 
     652                    y1 = preceedingScrollEventObj.scrollPosition[1] - eventObj.scrollPosition[1]; 
     653                    y2 = eventObj.scrollPosition[1] - getScrollCoordinates(node)[1]; 
     654                     
     655                    if ((((x1 >= 0) && (x2 >= 0)) || ((x1 <= 0) && (x2 <= 0))) && 
     656                        (((y1 >= 0) && (y2 >= 0)) || ((y1 <= 0) && (y2 <= 0)))) 
     657                    { 
     658                        // The new scrolling is a continuation of the previous scrolling --> reuse 
     659                        // previous object 
     660                    } 
     661                    else { 
     662                        eventObj = null; 
     663                    } 
     664                } 
     665                else { 
     666                    // we cannot determine the preceeding scroll direction, so we have to store the 
     667                    // new event 
     668                    eventObj = null; 
     669                } 
    628670            } 
    629671        } 
     
    821863 */ 
    822864function getScrollCoordinates(node) { 
    823     if (node.scrollLeft || node.scrollTop) { 
     865    if (typeof node.scrollLeft !== 'undefined') { 
    824866        return [node.scrollLeft, node.scrollTop]; 
    825867    } 
    826     else if ((node === window) && window.pageYOffset) { 
     868    else if ((node === window) && (typeof window.pageXOffset !== 'undefined')) { 
    827869        return [window.pageXOffset, window.pageYOffset]; 
    828870    } 
    829     else if ((node == document) || (node == document.body) || (node == document.documentElement)) {  
    830         if (document.body && (document.body.scrollLeft || document.body.scrollTop)) { 
     871    else if ((node === document) || (node === document.body) || 
     872             (node === document.documentElement)) 
     873    {  
     874        if ((typeof document.body !== 'undefined') && 
     875            (typeof document.body.scrollLeft !== 'undefined')) 
     876        { 
    831877            return [document.body.scrollLeft, document.body.scrollTop]; 
    832878        } 
    833         else if (document.documentElement && 
    834                  (document.documentElement.scrollLeft || document.documentElement.scrollTop)) 
     879        else if ((typeof document.documentElement !== 'undefined') && 
     880                 (typeof document.documentElement.scrollLeft !== 'undefined')) 
    835881        { 
    836882            return [document.documentElement.scrollLeft, document.documentElement.scrollTop]; 
Note: See TracChangeset for help on using the changeset viewer.