Response ExtractXPath Method C# API
Returns a string object from the HTML or XML response content that matches the given XPath expression.

Namespace: Facilita.Web
Assembly: clrWebBrowser (in clrWebBrowser.dll) Version: (

public virtual string ExtractXPath(
	string xpathExpression,
	ActionType failAction


Type: System String
The XPath expression to be applied to the response content.
Type: Facilita.Fc.Runtime ActionType
The action to take if the extract failed.

Return Value

The extracted text, or an empty string if the extract failed.

This method is only applicable if the response content is either HTML or XML. The method returns the first element or attribute value that matches the XPath expression.

The following example demonstrates extracting a value from an HTML Response using an XPath expression. The value returned is stored in the required extract variable.
Response response = request.Send();
Set<string>("xpathExtractVariable", response.ExtractXPath("/html/body/h1", ActionType.ACT_WARNING));

// Check if a value was extracted. 
if (GetString("xpathExtractVariable").Length > 0)
    WriteMessage(String.Format("xpathExtractVariable: {0}", GetString("xpathExtractVariable")));
    WriteMessage("XPath extract found no match");
See Also