simulate a Users’ mouse actions

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • chrissirhc
    New Member
    • Jan 2008
    • 13

    #1

    simulate a Users’ mouse actions

    Hi,

    Is there anyway to simulate a Users’ mouse actions using coldfusion? The goal is the automatically complete a series of online forms that have text boxes, drop down menus, links and Submit buttons. Thanks
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    Not with Coldfusion, but should be possible with JavaScript unless you mean over a number of pages.

    Comment

    • chrissirhc
      New Member
      • Jan 2008
      • 13

      #3
      Yes, I would like to automate an order in a document management system. Total of five different web pages with the same URL.If Javascript is the answer, is it possible to nest the javascript between a series of <cfhttp> tags. (One set of <cfhttp> tags for each page)

      Comment

      • acoder
        Recognized Expert MVP
        • Nov 2006
        • 16032

        #4
        As far as I'm aware, I'm afraid not. Since you're using cfhttp, post the values to the action page using cfhttpparam. That should simulate a user posting a form.

        Comment

        • chrissirhc
          New Member
          • Jan 2008
          • 13

          #5
          Thanks for your help. Just so I'm clear, I can post data to the text fields of a form using <cfhttp> but I unable to click a button, drop down or check box.

          Comment

          • acoder
            Recognized Expert MVP
            • Nov 2006
            • 16032

            #6
            cfhttp can simulate a form submit to an action page, so the result of typing a few letters in a text field, checking a check box, selecting a radio button or an option from a drop down can all be simulated. You just have to post the results of those actions via cfhttpparam. For example, the checked checkbox value is passed when the form is submitted and unchecked ones are ignored.

            Comment

            • chrissirhc
              New Member
              • Jan 2008
              • 13

              #7
              Sometimes I'm a little slow. I like the blame the public school system in Kentucky. Now that I've plugged all of the form data into <cfhttp> and <cfhttpparram > tags I have a question about the cfhttparram type=body. Can the type=body be used to send a link click to the from action url?

              Comment

              • acoder
                Recognized Expert MVP
                • Nov 2006
                • 16032

                #8
                If it's a link click you want, just use cflocation to relocate to the linked page.

                Have you got the form simulation working?

                Comment

                • chrissirhc
                  New Member
                  • Jan 2008
                  • 13

                  #9
                  I haven't worked my way through the 5 pages in the ordering process.
                  Order Form Flow:
                  Page 1 - Login page(this I have completed with the form post - I think)
                  Page 2 - I need to click one link
                  Page 3 - This page is the hardest, I need to select a folder and then enter a quantity and click a button to enter my choose into a shopping cart
                  Page 4 - Text fields and drop down menus
                  Page 5 - Done(Confirmati on Page)
                  What ya thing, doable?

                  Comment

                  • acoder
                    Recognized Expert MVP
                    • Nov 2006
                    • 16032

                    #10
                    To test if a page request has been successful, check the cfhttp.fileCont ent variable for the response body or cfhttp.statusCo de for the status ("200 OK" would be successful).

                    What does the link do? Can you show the code for it.

                    Comment

                    • chrissirhc
                      New Member
                      • Jan 2008
                      • 13

                      #11
                      The Link I need to click is called "Select Documents From Your Online Catalog" located at the bottom of the code.


                      [HTML]<script language="JavaS cript">

                      function setActionFields (hiddenActionVa lue) {
                      document.forms[0].routingAction. value = hiddenActionVal ue;
                      }

                      </script>

                      <form name="splashFor m" method="post" action="/SplashRouterAct ion.do">
                      <!-- this needs to be called here because of the warning pop ups at the bottom of this page (ref bug #9976) -->
                      <script language="javas cript">
                      makeFormsRelati ve();
                      </script>
                      <input type="hidden" name="routingAc tion" value="">

                      <<a href="javascrip t:document.form s[0].submit()" class="subheade rblack1" onclick="setAct ionFields('star tCatalogOrder') ;">Select Documents From Your Online Catalog</a><br><span class="subheade rblack1">Select documents from your company's online catalog and send to FedEx Kinko's for printing.</span> </td>
                      </form>[/HTML]
                      Last edited by acoder; Jan 7 '08, 08:29 AM. Reason: Added code tags

                      Comment

                      • acoder
                        Recognized Expert MVP
                        • Nov 2006
                        • 16032

                        #12
                        Since all the link does is submit the form, just make a HTTP request to the action page ("splashRouterA ction.do"). You will need to pass the hidden form field as a parameter using cfhttpparam. Set its value to "startCatalogOr der".

                        Comment

                        • chrissirhc
                          New Member
                          • Jan 2008
                          • 13

                          #13
                          Thanks for the clarity. Now the issue is when I use the secondary cfhttp request the site returns the login page. I added the username and password to the cfhttp statement but it did not work. Is this because the site is a https site?

                          !......My Code .....!

                          [CODE=cfm]<cfhttp url="https://docstore.kinkos .com/tirekingdom/SplashRouterAct ion.do" username="mtfbw yswibltn" password="!Chri ssirhc" method="post" resolveurl="yes " useragent="Mozi lla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727; FDM)" charset="utf-8">
                          <cfhttpparam type="formfield " name="keyword" value="startCat alogOrder">
                          </cfhttp>[/CODE]
                          Last edited by acoder; Jan 8 '08, 09:17 AM. Reason: Added code tags

                          Comment

                          • acoder
                            Recognized Expert MVP
                            • Nov 2006
                            • 16032

                            #14
                            I'm not sure if it would work if it's an https site.

                            It's about the session being maintained across pages to avoid login pages. Are all the pages from the same domain?

                            Comment

                            • chrissirhc
                              New Member
                              • Jan 2008
                              • 13

                              #15
                              Yes, all of the pages are on the same Domain.

                              Comment

                              Working...