/// <summary> /// Attach browsers for each type provided. /// </summary> /// <param name="type"> The type of the browser to attach to. </param> public static IEnumerable <Browser> AttachBrowsers(BrowserType type = BrowserType.All) { var response = new List <Browser>(); if ((type & BrowserType.Chrome) == BrowserType.Chrome) { response.Add(Chrome.Attach()); } if ((type & BrowserType.Edge) == BrowserType.Edge) { response.Add(Edge.Attach()); } if ((type & BrowserType.InternetExplorer) == BrowserType.InternetExplorer) { response.Add(InternetExplorer.Attach()); } if ((type & BrowserType.Firefox) == BrowserType.Firefox) { response.Add(Firefox.Attach()); } return(response); }
public void Attach() { using (var browser = Chrome.Create()) { Assert.IsNotNull(browser); } using (var browser = Chrome.Attach()) { Assert.IsNotNull(browser); Console.WriteLine(browser.Id); browser.NavigateTo("http://localhost:8080"); browser.Elements.Count.Dump(); browser.ExecuteScript("window.location.href").Dump(); } }
protected internal override void OnEnter(Engine.CoreEngine engine) { Chrome.Attach(engine.Form); var menu = new Interface.Menu() { Position = new Vector2(), Size = new Vector2(9000, 40) }; menu.Items.AddRange("File", "Edit", "View", "Window", "Help"); menu.Items[0].Children.AddRange("New", "Open", "Save", "Exit"); menu.Items[0].Children[3].Clicked += (s, e) => engine.Form.Close(); menu.Items[1].Children.AddRange("Cut", "Copy", "Paste"); menu.Items[4].Children.AddRange("About"); Chrome.Controls.Add(menu); var entityTree = new Interface.Custom.EntityComponentTree(Scene) { Position = new Vector2(10, 100), Size = new Vector2(200, 400), }; Chrome.Controls.Add(entityTree); var skyBox = Texture2D.FromFile(Engine.Device, "../../skybox/right.jpg", "../../skybox/left.jpg", "../../skybox/top.jpg", "../../skybox/bottom.jpg", "../../skybox/front.jpg", "../../skybox/back.jpg"); pbr.skybox = skyBox; sbr.skybox = skyBox; var material = new Material() { Albedo = Texture2D.FromFile(Engine.Device, "../../pbr/albedo.jpg"), Normal = Texture2D.FromFile(Engine.Device, "../../pbr/normal.jpg"), Roughness = Texture2D.FromFile(Engine.Device, "../../pbr/roughness.jpg"), Height = Texture2D.FromFile(Engine.Device, "../../pbr/height.jpg"), Specular = Texture2D.FromFile(Engine.Device, "../../pbr/metallic.jpg"), Alpha = Texture2D.FromFile(Engine.Device, "../../pbr/alpha.jpg"), Occlusion = Texture2D.FromFile(Engine.Device, "../../pbr/ambientocclusion.jpg"), }; material.Roughness = material.Height; //material.Specular = material.Normal; Color red = Color.Red; Color green = Color.Green; var aMaterial = new Material() { //Albedo = Texture2D.FromColor(Engine.Device, Color.Red), Albedo = Texture2D.FromColor(Engine.Device, new Color(0.7038f, 0.27048f, 0.0828f, 1f)), Normal = Texture2D.FromColor(Engine.Device, new Color(0.5f, 1f, 0.5f)), Roughness = Texture2D.FromColor(Engine.Device, new Color(0.2f)), Specular = Texture2D.FromColor(Engine.Device, new Color(0.256777f, 0.137622f, 0.086014f, 1)), Occlusion = Texture2D.FromColor(Engine.Device, Color.White), }; var shipModel = Model.FromMesh(Engine.Device, Mathematics.Geometry.WavefrontObj.Load("../../Model.obj")); shipModel.Materials.Add(material); var missileModel = Model.FromMesh(Engine.Device, Mathematics.Geometry.WavefrontObj.Load("../../Missile.obj")); missileModel.Materials.Add(material); var boxModel = Model.FromMesh(Engine.Device, Mathematics.Geometry.Mesh.CreateCube().Invert()); var rock1 = Model.FromMesh(Engine.Device, Mathematics.Geometry.WavefrontObj.Load("../../Rock1.obj")); rock1.Materials.Add(aMaterial); var rock2 = Model.FromMesh(Engine.Device, Mathematics.Geometry.WavefrontObj.Load("../../Rock2.obj")); rock2.Materials.Add(aMaterial); Scene.Entities.Add(new Entity("Camera") .Add(camera = new Camera { View = view, Projection = projection, }) .Add(new Renderable { Model = boxModel, Renderer = sbr, })); Scene.Entities.Add(new Entity("Ship 1", new Transform { Scaling = new Axiverse.Vector3(5), }) .Add(new Renderable() { Model = rock2, Renderer = pbr, }) .Add(new Physical())); Scene.Entities.Add(new Entity("Point Light", new Transform { Translation = new Axiverse.Vector3(4, 50, 6), }) .Add(new Light() { Color = Color.White, Intensity = 1, })); for (int i = 0; i < 100; i++) { Physical p; Scene.Entities.Add(new Entity("Missile " + (i + 1), new Transform { Scaling = new Axiverse.Vector3(0.2f, 1, 0.2f), }) .Add(new Renderable() { Model = missileModel, Renderer = pbr, }) .Add(new Agent()) .Add(p = new Physical())); p.Body.AngularPosition = Functions.Random.NextQuaternion(); } }
/// <summary> /// Attach process as a browser. /// </summary> /// <param name="process"> The process of the browser to attach to. </param> /// <returns> The browser if successfully attached or otherwise null. </returns> public static Browser AttachToBrowser(Process process) { return(Chrome.Attach(process) ?? Edge.Attach(process) ?? InternetExplorer.Attach(process) ?? Firefox.Attach(process)); }