Jmeter- I am unable to sign up using CSS Selector extractor using Jmeter- Please Help



  • I am working on Jmeter for testing a Magento application. I am using CSS Selector Extractor for extracting the form_key element during sign up. I have provided the following parameters in CSS selector extractorCSS Selector Extractor

    enter image description here

    enter image description here



    1. Double check that the extracted ${form_key} variable really has the value using Debug Sampler and View Results Tree listener combination

    2. Try recording the request for creating the account using JMeter's HTTP(S) Test Script Recorder, it might be the case your Magento instance requires some custom parameters

    I cannot reproduce your issue using online Magento demo version from http://demo-acm-2.bird.eu/customer/account/create/

    enter image description here

    Here is a reference script just in case:

    <?xml version="1.0" encoding="UTF-8"?>
    <jmeterTestPlan version="1.2" properties="5.0" jmeter="5.2.1">
        <hashTree>
            <TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="Test Plan" enabled="true">
                <stringProp name="TestPlan.comments"></stringProp>
                <boolProp name="TestPlan.functional_mode">false</boolProp>
                <boolProp name="TestPlan.tearDown_on_shutdown">true</boolProp>
                <boolProp name="TestPlan.serialize_threadgroups">false</boolProp>
                <elementProp name="TestPlan.user_defined_variables" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
                    <collectionProp name="Arguments.arguments"/>
                </elementProp>
                <stringProp name="TestPlan.user_define_classpath"></stringProp>
            </TestPlan>
            <hashTree>
                <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="Thread Group" enabled="true">
                    <stringProp name="ThreadGroup.on_sample_error">continue</stringProp>
                    <elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller" enabled="true">
                        <boolProp name="LoopController.continue_forever">false</boolProp>
                        <stringProp name="LoopController.loops">1</stringProp>
                    </elementProp>
                    <stringProp name="ThreadGroup.num_threads">1</stringProp>
                    <stringProp name="ThreadGroup.ramp_time">1</stringProp>
                    <boolProp name="ThreadGroup.scheduler">false</boolProp>
                    <stringProp name="ThreadGroup.duration"></stringProp>
                    <stringProp name="ThreadGroup.delay"></stringProp>
                    <boolProp name="ThreadGroup.same_user_on_next_iteration">true</boolProp>
                </ThreadGroup>
                <hashTree>
                    <CookieManager guiclass="CookiePanel" testclass="CookieManager" testname="HTTP Cookie Manager" enabled="true">
                        <collectionProp name="CookieManager.cookies"/>
                        <boolProp name="CookieManager.clearEachIteration">false</boolProp>
                        <boolProp name="CookieManager.controlledByThreadGroup">false</boolProp>
                    </CookieManager>
                    <hashTree/>
                    <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="http://demo-acm-2.bird.eu/customer/account/create/" enabled="true">
                        <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
                            <collectionProp name="Arguments.arguments"/>
                        </elementProp>
                        <stringProp name="HTTPSampler.domain">demo-acm-2.bird.eu</stringProp>
                        <stringProp name="HTTPSampler.port"></stringProp>
                        <stringProp name="HTTPSampler.protocol">http</stringProp>
                        <stringProp name="HTTPSampler.contentEncoding"></stringProp>
                        <stringProp name="HTTPSampler.path">/customer/account/create/</stringProp>
                        <stringProp name="HTTPSampler.method">GET</stringProp>
                        <boolProp name="HTTPSampler.follow_redirects">true</boolProp>
                        <boolProp name="HTTPSampler.auto_redirects">false</boolProp>
                        <boolProp name="HTTPSampler.use_keepalive">true</boolProp>
                        <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp>
                        <stringProp name="HTTPSampler.embedded_url_re"></stringProp>
                        <stringProp name="HTTPSampler.connect_timeout"></stringProp>
                        <stringProp name="HTTPSampler.response_timeout"></stringProp>
                    </HTTPSamplerProxy>
                    <hashTree>
                        <HtmlExtractor guiclass="HtmlExtractorGui" testclass="HtmlExtractor" testname="CSS Selector Extractor" enabled="true">
                            <stringProp name="HtmlExtractor.refname">form_key</stringProp>
                            <stringProp name="HtmlExtractor.expr">input[name=form_key]</stringProp>
                            <stringProp name="HtmlExtractor.attribute">value</stringProp>
                            <stringProp name="HtmlExtractor.default"></stringProp>
                            <boolProp name="HtmlExtractor.default_empty_value">false</boolProp>
                            <stringProp name="HtmlExtractor.match_number"></stringProp>
                            <stringProp name="HtmlExtractor.extractor_impl"></stringProp>
                        </HtmlExtractor>
                        <hashTree/>
                    </hashTree>
                    <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="http://demo-acm-2.bird.eu/customer/account/createpost/" enabled="true">
                        <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
                            <collectionProp name="Arguments.arguments">
                                <elementProp name="form_key" elementType="HTTPArgument">
                                    <boolProp name="HTTPArgument.always_encode">false</boolProp>
                                    <stringProp name="Argument.value">${form_key}</stringProp>
                                    <stringProp name="Argument.metadata">=</stringProp>
                                    <boolProp name="HTTPArgument.use_equals">true</boolProp>
                                    <stringProp name="Argument.name">form_key</stringProp>
                                </elementProp>
                                <elementProp name="success_url" elementType="HTTPArgument">
                                    <boolProp name="HTTPArgument.always_encode">false</boolProp>
                                    <stringProp name="Argument.value"></stringProp>
                                    <stringProp name="Argument.metadata">=</stringProp>
                                    <boolProp name="HTTPArgument.use_equals">true</boolProp>
                                    <stringProp name="Argument.name">success_url</stringProp>
                                </elementProp>
                                <elementProp name="error_url" elementType="HTTPArgument">
                                    <boolProp name="HTTPArgument.always_encode">false</boolProp>
                                    <stringProp name="Argument.value"></stringProp>
                                    <stringProp name="Argument.metadata">=</stringProp>
                                    <boolProp name="HTTPArgument.use_equals">true</boolProp>
                                    <stringProp name="Argument.name">error_url</stringProp>
                                </elementProp>
                                <elementProp name="firstname" elementType="HTTPArgument">
                                    <boolProp name="HTTPArgument.always_encode">false</boolProp>
                                    <stringProp name="Argument.value">foo</stringProp>
                                    <stringProp name="Argument.metadata">=</stringProp>
                                    <boolProp name="HTTPArgument.use_equals">true</boolProp>
                                    <stringProp name="Argument.name">firstname</stringProp>
                                </elementProp>
                                <elementProp name="lastname" elementType="HTTPArgument">
                                    <boolProp name="HTTPArgument.always_encode">false</boolProp>
                                    <stringProp name="Argument.value">bar</stringProp>
                                    <stringProp name="Argument.metadata">=</stringProp>
                                    <boolProp name="HTTPArgument.use_equals">true</boolProp>
                                    <stringProp name="Argument.name">lastname</stringProp>
                                </elementProp>
                                <elementProp name="email" elementType="HTTPArgument">
                                    <boolProp name="HTTPArgument.always_encode">false</boolProp>
                                    <stringProp name="Argument.value">${__RandomString(10,abcdefjkijklmnopqrstuvwxyz,)}@example.cim</stringProp>
                                    <stringProp name="Argument.metadata">=</stringProp>
                                    <boolProp name="HTTPArgument.use_equals">true</boolProp>
                                    <stringProp name="Argument.name">email</stringProp>
                                </elementProp>
                                <elementProp name="password" elementType="HTTPArgument">
                                    <boolProp name="HTTPArgument.always_encode">false</boolProp>
                                    <stringProp name="Argument.value">summer@1</stringProp>
                                    <stringProp name="Argument.metadata">=</stringProp>
                                    <boolProp name="HTTPArgument.use_equals">true</boolProp>
                                    <stringProp name="Argument.name">password</stringProp>
                                </elementProp>
                                <elementProp name="password_confirmation" elementType="HTTPArgument">
                                    <boolProp name="HTTPArgument.always_encode">false</boolProp>
                                    <stringProp name="Argument.value">summer@1</stringProp>
                                    <stringProp name="Argument.metadata">=</stringProp>
                                    <boolProp name="HTTPArgument.use_equals">true</boolProp>
                                    <stringProp name="Argument.name">password_confirmation</stringProp>
                                </elementProp>
                            </collectionProp>
                        </elementProp>
                        <stringProp name="HTTPSampler.domain">demo-acm-2.bird.eu</stringProp>
                        <stringProp name="HTTPSampler.port"></stringProp>
                        <stringProp name="HTTPSampler.protocol">http</stringProp>
                        <stringProp name="HTTPSampler.contentEncoding">UTF-8</stringProp>
                        <stringProp name="HTTPSampler.path">/customer/account/createpost/</stringProp>
                        <stringProp name="HTTPSampler.method">POST</stringProp>
                        <boolProp name="HTTPSampler.follow_redirects">true</boolProp>
                        <boolProp name="HTTPSampler.auto_redirects">false</boolProp>
                        <boolProp name="HTTPSampler.use_keepalive">true</boolProp>
                        <boolProp name="HTTPSampler.DO_MULTIPART_POST">true</boolProp>
                        <boolProp name="HTTPSampler.BROWSER_COMPATIBLE_MULTIPART">true</boolProp>
                        <stringProp name="HTTPSampler.embedded_url_re"></stringProp>
                        <stringProp name="HTTPSampler.connect_timeout"></stringProp>
                        <stringProp name="HTTPSampler.response_timeout"></stringProp>
                    </HTTPSamplerProxy>
                    <hashTree/>
                    <DebugSampler guiclass="TestBeanGUI" testclass="DebugSampler" testname="Debug Sampler" enabled="true">
                        <boolProp name="displayJMeterProperties">false</boolProp>
                        <boolProp name="displayJMeterVariables">true</boolProp>
                        <boolProp name="displaySystemProperties">false</boolProp>
                    </DebugSampler>
                    <hashTree/>
                    <ResultCollector guiclass="ViewResultsFullVisualizer" testclass="ResultCollector" testname="View Results Tree" enabled="true">
                        <boolProp name="ResultCollector.error_logging">false</boolProp>
                        <objProp>
                            <name>saveConfig</name>
                            <value class="SampleSaveConfiguration">
                                <time>true</time>
                                <latency>true</latency>
                                <timestamp>true</timestamp>
                                <success>true</success>
                                <label>true</label>
                                <code>true</code>
                                <message>true</message>
                                <threadName>true</threadName>
                                <dataType>true</dataType>
                                <encoding>false</encoding>
                                <assertions>true</assertions>
                                <subresults>true</subresults>
                                <responseData>false</responseData>
                                <samplerData>false</samplerData>
                                <xml>false</xml>
                                <fieldNames>true</fieldNames>
                                <responseHeaders>false</responseHeaders>
                                <requestHeaders>false</requestHeaders>
                                <responseDataOnError>false</responseDataOnError>
                                <saveAssertionResultsFailureMessage>true</saveAssertionResultsFailureMessage>
                                <assertionsResultsToSave>0</assertionsResultsToSave>
                                <bytes>true</bytes>
                                <sentBytes>true</sentBytes>
                                <url>true</url>
                                <threadCounts>true</threadCounts>
                                <idleTime>true</idleTime>
                                <connectTime>true</connectTime>
                            </value>
                        </objProp>
                        <stringProp name="filename"></stringProp>
                    </ResultCollector>
                    <hashTree/>
                </hashTree>
            </hashTree>
        </hashTree>
    </jmeterTestPlan>
    


Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2