Getting js objects from browser console and Jmeter












0















I'm working on a new project, the client is a bank and I need to perform performance tests, I wanted to use jmeter as a main tool, but I found a problem, most of the pages ask for a token, so I need to catch token and set this to the next POST request in order to login and continue through the different page forms, the problem is that this token is generated by a javascript, so is not returned in any GET response body; I can just get it by console's browser, because this token is generated in a javascript object.



I've tried with postProcessor elements as regular expression extractor, JSR223 PostProcessor (I'm not a pro with) and finally with Webdriver Sampler, this last one is working, but I had to import some Java classes, did some modifications, etc; but I this is not an option, because if I perform the test with several virtual users the machine is going to run out of resources.



I was wondering if you have faced with something similar, if so, could you please make me a suggestion?, maybe perform tests with a different tool, framework...



Thanks in advance.










share|improve this question



























    0















    I'm working on a new project, the client is a bank and I need to perform performance tests, I wanted to use jmeter as a main tool, but I found a problem, most of the pages ask for a token, so I need to catch token and set this to the next POST request in order to login and continue through the different page forms, the problem is that this token is generated by a javascript, so is not returned in any GET response body; I can just get it by console's browser, because this token is generated in a javascript object.



    I've tried with postProcessor elements as regular expression extractor, JSR223 PostProcessor (I'm not a pro with) and finally with Webdriver Sampler, this last one is working, but I had to import some Java classes, did some modifications, etc; but I this is not an option, because if I perform the test with several virtual users the machine is going to run out of resources.



    I was wondering if you have faced with something similar, if so, could you please make me a suggestion?, maybe perform tests with a different tool, framework...



    Thanks in advance.










    share|improve this question

























      0












      0








      0








      I'm working on a new project, the client is a bank and I need to perform performance tests, I wanted to use jmeter as a main tool, but I found a problem, most of the pages ask for a token, so I need to catch token and set this to the next POST request in order to login and continue through the different page forms, the problem is that this token is generated by a javascript, so is not returned in any GET response body; I can just get it by console's browser, because this token is generated in a javascript object.



      I've tried with postProcessor elements as regular expression extractor, JSR223 PostProcessor (I'm not a pro with) and finally with Webdriver Sampler, this last one is working, but I had to import some Java classes, did some modifications, etc; but I this is not an option, because if I perform the test with several virtual users the machine is going to run out of resources.



      I was wondering if you have faced with something similar, if so, could you please make me a suggestion?, maybe perform tests with a different tool, framework...



      Thanks in advance.










      share|improve this question














      I'm working on a new project, the client is a bank and I need to perform performance tests, I wanted to use jmeter as a main tool, but I found a problem, most of the pages ask for a token, so I need to catch token and set this to the next POST request in order to login and continue through the different page forms, the problem is that this token is generated by a javascript, so is not returned in any GET response body; I can just get it by console's browser, because this token is generated in a javascript object.



      I've tried with postProcessor elements as regular expression extractor, JSR223 PostProcessor (I'm not a pro with) and finally with Webdriver Sampler, this last one is working, but I had to import some Java classes, did some modifications, etc; but I this is not an option, because if I perform the test with several virtual users the machine is going to run out of resources.



      I was wondering if you have faced with something similar, if so, could you please make me a suggestion?, maybe perform tests with a different tool, framework...



      Thanks in advance.







      jmeter performance-testing






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 24 '18 at 18:52









      Guillermo LazoGuillermo Lazo

      1




      1
























          1 Answer
          1






          active

          oldest

          votes


















          0














          First of all I would recommend looking into the response more attentively as the token might be coming as a Cookie or a Header, if this is the case you should be able to extract it using HTTP Cookie Manager or Regular Expression Extractor correspondingly.



          If the token is generated via JavaScript code you can re-implement the logic using Groovy language and use vars.put() function in order to store the generated value into JMeter Variables. If you cannot come up with the relevant Groovy code - update your question with the JavaScript code snippet and most probably we'll be able to help you with converting it into Groovy and exposing to next Sampler(s)






          share|improve this answer























            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53461370%2fgetting-js-objects-from-browser-console-and-jmeter%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            First of all I would recommend looking into the response more attentively as the token might be coming as a Cookie or a Header, if this is the case you should be able to extract it using HTTP Cookie Manager or Regular Expression Extractor correspondingly.



            If the token is generated via JavaScript code you can re-implement the logic using Groovy language and use vars.put() function in order to store the generated value into JMeter Variables. If you cannot come up with the relevant Groovy code - update your question with the JavaScript code snippet and most probably we'll be able to help you with converting it into Groovy and exposing to next Sampler(s)






            share|improve this answer




























              0














              First of all I would recommend looking into the response more attentively as the token might be coming as a Cookie or a Header, if this is the case you should be able to extract it using HTTP Cookie Manager or Regular Expression Extractor correspondingly.



              If the token is generated via JavaScript code you can re-implement the logic using Groovy language and use vars.put() function in order to store the generated value into JMeter Variables. If you cannot come up with the relevant Groovy code - update your question with the JavaScript code snippet and most probably we'll be able to help you with converting it into Groovy and exposing to next Sampler(s)






              share|improve this answer


























                0












                0








                0







                First of all I would recommend looking into the response more attentively as the token might be coming as a Cookie or a Header, if this is the case you should be able to extract it using HTTP Cookie Manager or Regular Expression Extractor correspondingly.



                If the token is generated via JavaScript code you can re-implement the logic using Groovy language and use vars.put() function in order to store the generated value into JMeter Variables. If you cannot come up with the relevant Groovy code - update your question with the JavaScript code snippet and most probably we'll be able to help you with converting it into Groovy and exposing to next Sampler(s)






                share|improve this answer













                First of all I would recommend looking into the response more attentively as the token might be coming as a Cookie or a Header, if this is the case you should be able to extract it using HTTP Cookie Manager or Regular Expression Extractor correspondingly.



                If the token is generated via JavaScript code you can re-implement the logic using Groovy language and use vars.put() function in order to store the generated value into JMeter Variables. If you cannot come up with the relevant Groovy code - update your question with the JavaScript code snippet and most probably we'll be able to help you with converting it into Groovy and exposing to next Sampler(s)







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 26 '18 at 9:36









                Dmitri TDmitri T

                72.9k33764




                72.9k33764
































                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53461370%2fgetting-js-objects-from-browser-console-and-jmeter%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Wiesbaden

                    Marschland

                    Dieringhausen