Class XPathExtractor
-
- All Implemented Interfaces:
-
java.io.Serializable
,java.lang.Cloneable
,org.apache.jmeter.gui.Searchable
,org.apache.jmeter.processor.PostProcessor
,org.apache.jmeter.testelement.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.
-
-
Field Summary
Fields Modifier and Type Field Description public final static String
DEFAULT_VALUE_AS_STRING
public transient JMeterContext
threadContext
public transient String
threadName
public final static TestElement.Companion
Companion
public final static String
NAME
public final static String
GUI_CLASS
public final static String
ENABLED
public final static String
TEST_CLASS
public final static String
COMMENTS
-
Constructor Summary
Constructors Constructor Description XPathExtractor()
-
Method Summary
Modifier and Type Method Description void
process()
Do the job - extract value from (X)HTML response using XPath Query. void
setXPathQuery(String val)
String
getXPathQuery()
void
setRefName(String refName)
String
getRefName()
void
setDefaultValue(String val)
String
getDefaultValue()
void
setTolerant(boolean val)
boolean
isTolerant()
void
setNameSpace(boolean val)
boolean
useNameSpace()
void
setReportErrors(boolean val)
boolean
reportErrors()
void
setShowWarnings(boolean val)
boolean
showWarnings()
void
setQuiet(boolean val)
boolean
isQuiet()
boolean
getFragment()
Should we return fragment as text, rather than text of fragment? void
setFragment(boolean selected)
Should we return fragment as text, rather than text of fragment? void
setWhitespace(boolean selected)
boolean
isWhitespace()
void
setValidating(boolean selected)
boolean
isValidating()
void
setDownloadDTDs(boolean selected)
boolean
isDownloadDTDs()
void
setMatchNumber(int matchNumber)
Set which Match to use. void
setMatchNumber(String matchNumber)
Set which Match to use. int
getMatchNumber()
Return which Match to use. String
getMatchNumberAsString()
Return which Match to use. -
Methods inherited from class org.apache.jmeter.testelement.AbstractTestElement
addTestElement, canRemove, clear, clearTestElementChildren, clone, equals, getComment, getName, getProperty, getPropertyAsBoolean, getPropertyAsDouble, getPropertyAsFloat, getPropertyAsInt, getPropertyAsLong, getPropertyAsString, getPropertyOrNull, getSearchableTokens, getThreadContext, getThreadName, hashCode, isEnabled, isRunningVersion, isTemporary, propertyIterator, recoverRunningVersion, removeProperty, setComment, setEnabled, setName, setProperty, setRunningVersion, setTemporary, setThreadContext, setThreadName, traverse
-
Methods inherited from class org.apache.jmeter.testelement.AbstractScopedTestElement
fetchScope, getProps, getSchema, getVariableName, isScopeAll, isScopeChildren, isScopeParent, isScopeVariable, setScopeAll, setScopeChildren, setScopeParent, setScopeVariable
-
Methods inherited from class org.apache.jmeter.testelement.TestElement
get, get, get, get, get, get, get, get, get, getOrCreate, getOrCreate, getOrNull, getOrNull, getOrNull, getProps, getSchema, getString, removed, set
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Method Detail
-
process
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.
-
setXPathQuery
void setXPathQuery(String val)
-
getXPathQuery
String getXPathQuery()
-
setRefName
void setRefName(String refName)
-
getRefName
String getRefName()
-
setDefaultValue
void setDefaultValue(String val)
-
getDefaultValue
String getDefaultValue()
-
setTolerant
void setTolerant(boolean val)
-
isTolerant
boolean isTolerant()
-
setNameSpace
void setNameSpace(boolean val)
-
useNameSpace
boolean useNameSpace()
-
setReportErrors
void setReportErrors(boolean val)
-
reportErrors
boolean reportErrors()
-
setShowWarnings
void setShowWarnings(boolean val)
-
showWarnings
boolean showWarnings()
-
setQuiet
void setQuiet(boolean val)
-
isQuiet
boolean isQuiet()
-
getFragment
boolean getFragment()
Should we return fragment as text, rather than text of fragment?
- Returns:
true if we should return fragment rather than text
-
setFragment
void setFragment(boolean selected)
Should we return fragment as text, rather than text of fragment?
- Parameters:
selected
- true to return fragment.
-
setWhitespace
void setWhitespace(boolean selected)
-
isWhitespace
boolean isWhitespace()
-
setValidating
void setValidating(boolean selected)
-
isValidating
boolean isValidating()
-
setDownloadDTDs
void setDownloadDTDs(boolean selected)
-
isDownloadDTDs
boolean isDownloadDTDs()
-
setMatchNumber
void setMatchNumber(int matchNumber)
Set which Match to use. This can be any positive number, indicating the exact match to use, or
0
, which is interpreted as meaning random.- Parameters:
matchNumber
- The number of the match to be used
-
setMatchNumber
void setMatchNumber(String matchNumber)
Set which Match to use. This can be any positive number, indicating the exact match to use, or
0
, which is interpreted as meaning random.- Parameters:
matchNumber
- The number of the match to be used
-
getMatchNumber
int getMatchNumber()
Return which Match to use. This can be any positive number, indicating the exact match to use, or
0
, which is interpreted as meaning random.- Returns:
matchNumber The number of the match to be used
-
getMatchNumberAsString
String getMatchNumberAsString()
Return which Match to use. This can be any positive number, indicating the exact match to use, or
0
, which is interpreted as meaning random.- Returns:
matchNumber The number of the match to be used
-
-
-
-