Reflection 2014 .NET API Guide
Get Text from a Web Page

This sample program shows how to get text from a Web page document that's open in Reflection. To do this, we get a Web control object to access the Web page document and then use the XPATH to identify the Web element (text) on the page, as follows:

IWebElement WebElement = WebDocument.GetElement("HTML/BODY/TABLE/TBODY/TR[1]/TD[1]")

You can also use the ID to work with Web elements. For an example, see Integrate Web and Host Data.

To create a Web page document

  1. Using a text editor, such as Notepad, create a new text file called table.htm.
  2. Copy this HTML code into the text file, and then save the file.
  3. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">

    <html xmlns="" >


      <title>HTML Test Page</title>



      <table border="1">


        <tr id="first-table-tr">

          <td id="USDOLLAR">U.S. Dollars</td>







          <td>Canadian Dollars</td>














          <td>Japanese Yen</td>










  4. In Reflection, create a new Web page document and type the file path to table.htm in the URL box. For example, if you saved the file to


    type the following path (in one continuous string):


  5. Name the Web page document Webtable.urlx and save it to the same location as "table.htm."
  6. Quit, and then restart Reflection.
  7. In Visual Studio, create a new Console Application project. In the New Project dialog box, type Get a Web Object in the Name box.
  8. Select the Create directory for solution box, click Browse to select your API projects folder (for example, C:\MyProjects), and then click OK.
  9. In Solution Explorer, add the class assemblies. (For instructions, see Create an API Project.)
  10. Copy the code from Get a Web Object, paste it to the Program.cs tab, and then edit the path in the code to match the path to which you saved Webtable.urlx.
  11. Build the application (Build > Rebuild Solution) and then run it (Debug > Start Without Debugging).

A console box should appear with the text extracted from Webtable.urlx: "The currency conversion rate from Canadian to U.S. Dollar: [number]. Press any key to continue..."