Exemple #1
0
        public async Task ShouldExposeFunction()
        {
            await _page.GoToAsync(TestConstants.ServerUrl + "/dynamic-oopif.html");

            Assert.Equal(2, _page.Frames.Count());
            Assert.Equal(1, await CountOOPIFsASync(_browser));

            var oopif = _page.Frames[1];
            await _page.ExposeFunctionAsync("mul", (int a, int b) => a *b);

            int result = await oopif.EvaluateAsync <int>(@"async function() {
              return await mul(9, 4);
            }");

            Assert.Equal(36, result);
        }