XPaths are used to select HTML elements on a web page. XPath syntax is very flexible, but sometimes you may need to create a custom XPath function to get the exact selection you want.
Custom XPath functions are C# or VB.NET scripts and are only available when you manually edit the selection XPath for a content or template.
This example shows how to create an XPath that selects all HTML elements with text matching a Visual Web Ripper Input Parameter.
Step 1Add the input parameter that will contain the text to search for.
Step 2Create the custom XPath function that will compare the current node text with the Input Parameter.
Custom XPath functions are created/edited from the Advanced options tab. Custom XPath functions are shared across the entire project.

Custom XPath functions can have any number of parameters, but the optional WrXpathArguments must be the first parameter. The return type does not need to be a Boolean, but could also be an Integer for example.
Code:using System;
using mshtml;
using VisualWebRipper;
public class Script
{
public static bool SelectTagByText(WrXpathArguments args, string tagText)
{
try
{
if(args.InputParameters.Contains("tag_text"))
return args.InputParameters["tag_text"].Equals(tagText,
StringComparison.InvariantCultureIgnoreCase);
else
return false;
}
catch(Exception exp)
{
args.WriteDebug(exp.Message);
return false;
}
}
}
Step 3Add a content element and set the XPath manually to:
//*[SelectTagByText(.)]
This XPath will select all HTML elements on the web page that contain inner text that matches the value of the input parameter "tag_text".
Notice that the XPath method argument WrXpathArguments is automatically added by Visual Web Ripper, so you don't have to specify this argument when you use the custom XPath method.
Please see this post for more information about Input Parameters:
http://www.visualwebripp...-scraping-projects.aspx