예제 #1
0
        private static void Main(string[] args)
        {
            try
            {
                using (IEngine engine = EngineFactory.Create(new EngineOptions.Builder().Build()))
                {
                    Console.WriteLine("Engine created");

                    using (IBrowser browser = engine.CreateBrowser())
                    {
                        Console.WriteLine("Browser created");
                        IJsObject arrayObject = browser.MainFrame
                                                .ExecuteJavaScript <IJsObject>(JsArray)
                                                .Result;

                        JsArray array = arrayObject.AsArray();
                        if (array != null)
                        {
                            Console.Out.WriteLine("Item count: " + array.Count);
                            foreach (object item in array)
                            {
                                Console.Out.WriteLine("Item: " + item);
                            }
                        }
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }

            Console.WriteLine("Press any key to terminate...");
            Console.ReadKey();
        }
예제 #2
0
        private static void Main(string[] args)
        {
            using (IEngine engine = EngineFactory.Create())
            {
                using (IBrowser browser = engine.CreateBrowser())
                {
                    IJsObject arrayObject = browser.MainFrame
                                            .ExecuteJavaScript <IJsObject>(JsArray)
                                            .Result;

                    JsArray array = arrayObject.AsArray();
                    if (array != null)
                    {
                        Console.Out.WriteLine($"Item count: {array.Count}");
                        foreach (object item in array)
                        {
                            Console.Out.WriteLine($"Item: {item}");
                        }
                    }
                }
            }

            Console.WriteLine("Press any key to terminate...");
            Console.ReadKey();
        }