# Class XPathExtractor

java.lang.Object
org.apache.jmeter.testelement.AbstractTestElement
org.apache.jmeter.testelement.AbstractScopedTestElement
org.apache.jmeter.extractor.XPathExtractor

All Implemented Interfaces:
  `Serializable, Cloneable, Searchable, PostProcessor, TestElement`

public class XPathExtractor extends AbstractScopedTestElement implements PostProcessor, Serializable
Extracts text from (X)HTML response using XPath query language Example XPath queries:

/html/head/title
  extracts Title from HTML response
//form[@name='countryForm']//select[@name='country']/option[text()='Czech Republic'])/@value
  extracts value attribute of option element that match text 'Czech Republic' inside of select element with name attribute 'country' inside of form with name attribute 'countryForm'
//head
  extracts the XML fragment for head node.
//head/text()
  extracts the text content for head node.

See Also:
  - Serialized Form

## Field Summary

### Fields inherited from interface TestElement

`COMMENTS, ENABLED, GUI_CLASS, NAME, TEST_CLASS`

## Constructor Summary

Constructors
Constructor
Description
`XPathExtractor()`

## Method Summary

Modifier and Type
Method
Description
`String`
`getDefaultValue()`
`boolean`
`getFragment()`
Should we return fragment as text, rather than text of fragment?
`String`
`getRefName()`
`String`
`getXPathQuery()`
`boolean`
`isDownloadDTDs()`
`boolean`
`isQuiet()`
`boolean`
`isTolerant()`
`boolean`
`isValidating()`
`boolean`
`isWhitespace()`
`void`
`process()`
Do the job - extract value from (X)HTML response using XPath Query.
`boolean`
`reportErrors()`
`void`
`setDefaultValue(String val)`
`void`
`setDownloadDTDs(boolean selected)`
`void`
`setFragment(boolean selected)`
Should we return fragment as text, rather than text of fragment?
`void`
`setNameSpace(boolean val)`
`void`
`setQuiet(boolean val)`
`void`
`setRefName(String refName)`
`void`
`setReportErrors(boolean val)`
`void`
`setShowWarnings(boolean val)`
`void`
`setTolerant(boolean val)`
`void`
`setValidating(boolean selected)`
`void`
`setWhitespace(boolean selected)`
`void`
`setXPathQuery(String val)`
`boolean`
`showWarnings()`
`boolean`
`useNameSpace()`

### Methods inherited from class AbstractScopedTestElement

`fetchScope, getSampleList, getScopeName, getVariableName, isScopeAll, isScopeChildren, isScopeParent, isScopeVariable, isScopeVariable, setScopeAll, setScopeChildren, setScopeParent, setScopeVariable`

### Methods inherited from class AbstractTestElement

`addPropertiesValues, addProperty, addProperty, addTestElement, canRemove, clear, clearTemporary, clearTestElementChildren, clone, emptyTemporary, equals, getComment, getName, getProperty, getPropertyAsBoolean, getPropertyAsBoolean, getPropertyAsDouble, getPropertyAsFloat, getPropertyAsInt, getPropertyAsInt, getPropertyAsLong, getPropertyAsLong, getPropertyAsString, getPropertyAsString, getSearchableTokens, getThreadContext, getThreadName, hashCode, isEnabled, isRunningVersion, isTemporary, logProperties, mergeIn, propertyIterator, recoverRunningVersion, removeProperty, setComment, setEnabled, setName, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setRunningVersion, setTemporary, setThreadContext, setThreadName, traverse, traverseCollection, traverseMap, traverseProperty`

### Methods inherited from class Object

`finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### XPathExtractor

public XPathExtractor()

## Method Details

### process

public void process()
Do the job - extract value from (X)HTML response using XPath Query. Return value as variable defined by REFNAME. Returns DEFAULT value if not found.

Specified by:
  `process` in interface `PostProcessor`

### setXPathQuery

public void setXPathQuery(String val)

### getXPathQuery

public String getXPathQuery()

### setRefName

public void setRefName(String refName)

### getRefName

public String getRefName()

### setDefaultValue

public void setDefaultValue(String val)

### getDefaultValue

public String getDefaultValue()

### setTolerant

public void setTolerant(boolean val)

### isTolerant

public boolean isTolerant()

### setNameSpace

public void setNameSpace(boolean val)

### useNameSpace

public boolean useNameSpace()

### setReportErrors

public void setReportErrors(boolean val)

### reportErrors

public boolean reportErrors()

### setShowWarnings

public void setShowWarnings(boolean val)

### showWarnings

public boolean showWarnings()

### setQuiet

public void setQuiet(boolean val)

### isQuiet

public boolean isQuiet()

### getFragment

public boolean getFragment()
Should we return fragment as text, rather than text of fragment?

Returns:
  true if we should return fragment rather than text

### setFragment

public void setFragment(boolean selected)
Should we return fragment as text, rather than text of fragment?

Parameters:
  `selected` - true to return fragment.

### setWhitespace

public void setWhitespace(boolean selected)

### isWhitespace

public boolean isWhitespace()

### setValidating

public void setValidating(boolean selected)

### isValidating

public boolean isValidating()

### setDownloadDTDs

public void setDownloadDTDs(boolean selected)

### isDownloadDTDs

public boolean isDownloadDTDs()