0
<DevCap ID="EFI_InterpretingParams" Name="InterpretingParams">
                <DevCap MaxOccurs="1" MinOccurs="0" Name="ObjectResolution">
                  <XYPairState AllowedValueList="600 600 1200 1200 1200 600 1400 1400 1440 1440 200 200 2400 1200 300 300 300 600 400 200 400 400 600 1200 600 2400 600 300 720 1440 720 720" HasDefault="false" MaxOccurs="1" MinOccurs="0" Name="Resolution" UnitType="Resolution"/>
                  <StringState HasDefault="false" MaxOccurs="1" MinOccurs="0" Name="AntiAliasing">
                    <Value AllowedValue="true"/>
                    <Value AllowedValue="false"/>
                    <Value AllowedValue="True"/>
                    <Value AllowedValue="None"/>
                    <Value AllowedValue="False"/>
                    <Value AllowedValue="AntiAlias"/>

Following Xpath assertion is not working:

//DevCap[@MaxOccurs="1" and @MinOccurs="0" and @Name="ObjectResolution"]/XYPairState[@AllowedValueList="600 600 1200 1200 1200 600 1400 1400 1440 1440 200 200 2400 1200 300 300 300 600 400 200 400 400 600 1200 600 2400 600 300 720 1440 720 720" and @HasDefault="false" and @MaxOccurs="1" and @MinOccurs="0" and @Name="Resolution" and @UnitType="Resolution"]

bumped to the homepage by Community 2 days ago

This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.

0
  1. Your XML is not well-formed, you won't be able to use the XPath Extractor if the response looks exactly the same as you mentioned in the question, there are at least 3 not-closed tags, missing root element, etc. In order to be able to use the XPath queries you should have something like:

    <root>
        <DevCap ID="EFI_InterpretingParams" Name="InterpretingParams"/>
        <DevCap MaxOccurs="1" MinOccurs="0" Name="ObjectResolution"/>
        <XYPairState
                AllowedValueList="600 600 1200 1200 1200 600 1400 1400 1440 1440 200 200 2400 1200 300 300 300 600 400 200 400 400 600 1200 600 2400 600 300 720 1440 720 720"
                HasDefault="false" MaxOccurs="1" MinOccurs="0" Name="Resolution" UnitType="Resolution"/>
        <StringState HasDefault="false" MaxOccurs="1" MinOccurs="0" Name="AntiAliasing"/>
        <Value AllowedValue="true"/>
        <Value AllowedValue="false"/>
        <Value AllowedValue="True"/>
        <Value AllowedValue="None"/>
        <Value AllowedValue="False"/>
        <Value AllowedValue="AntiAlias"/>
    </root>
    

    You can check yourself using an online XML validator

  2. You will not be able to locate XYPairState as //DevCap/XYPairState as they are at the same level, the correct approach would be going for following-sibling like:

    //DevCap/following-sibling::XYPairState
    
  3. Assuming all above the final XPath query should be something like:

    //DevCap[@MaxOccurs="1" and @MinOccurs="0" and @Name="ObjectResolution"]/following-sibling::XYPairState[@AllowedValueList="600 600 1200 1200 1200 600 1400 1400 1440 1440 200 200 2400 1200 300 300 300 600 400 200 400 400 600 1200 600 2400 600 300 720 1440 720 720" and @HasDefault="false" and @MaxOccurs="1" and @MinOccurs="0" and @Name="Resolution" and @UnitType="Resolution"]
    

    Demo:

    enter image description here

    Check out Using the XPath Extractor in JMeter article for more information on the specifics of using XPath query language in JMeter tests.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.