Muokkaa

Jaa


TestPage.Trap() Method

Version: Available or changed with runtime version 1.0.

Traps the next test page that is invoked and assigns it to the test page variable.

Syntax

 TestPage.Trap()

Parameters

TestPage
 Type: TestPage
An instance of the TestPage data type.

Remarks

Only non-modal pages can be trapped. To trap modal pages that you invoke with the RunModal method or the Page.RunModal() Method, you must use the ModalPageHandler method. For more information, see Create Handler Methods.

Example

This example shows how to use the Trap method to trap a call to open a test page so that the opened page is assigned to a variable.

local procedure TrapPage()

    begin
        CustomerCard.OpenEdit;
        CustomerStatistics.Trap(); // Next page invoked will be trapped and assigned to the CustomerStatistics variable  
        CustomerCard."Customer/Item Statistics".Invoke(); // Invokes an action from the Customer Card page   
        CustomerStatistics."Balance (LCY)".AssertEquals(0); // Now that the CustomerStatistics test page is open, use the variable to test the page

    end;

    var
        CustomerCard: TestPage "Customer Card";
        CustomerStatistics: TestPage "Customer Statistics";

TestPage Data Type
Get Started with AL
Developing Extensions