How to use ShouldSaveAsVideosFromRemoteBrowser method of Microsoft.Playwright.Tests.BrowserTypeConnectTests class

Best Playwright-dotnet code snippet using Microsoft.Playwright.Tests.BrowserTypeConnectTests.ShouldSaveAsVideosFromRemoteBrowser

Run Playwright-dotnet automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

BrowserTypeConnectTests.cs

Source: BrowserTypeConnectTests.cs Github

copy
1/*
2 * MIT License
3 *
4 * Copyright (c) Microsoft Corporation.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights
9 * to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
10 * copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in all
14 * copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 * SOFTWARE.
23 */
24
25using System;
26using System.Collections.Generic;
27using System.Diagnostics;
28using System.IO;
29using System.IO.Compression;
30using System.Text;
31using System.Threading;
32using System.Threading.Tasks;
33using Microsoft.AspNetCore.Http;
34using Microsoft.Playwright.Helpers;
35using Microsoft.Playwright.NUnit;
36using NUnit.Framework;
37
38namespace Microsoft.Playwright.Tests
39{
40    ///<playwright-file>browsertype-connect.spec.ts</playwright-file>
41    public class BrowserTypeConnectTests : PlaywrightTestEx
42    {
43        private RemoteServer _remoteServer;
44
45        [SetUp]
46        public void SetUpRemoteServer()
47        {
48            _remoteServer = new(BrowserType.Name);
49        }
50
51        [TearDown]
52        public void TearDownRemoteServer()
53        {
54            _remoteServer.Close();
55        }
56
57        [PlaywrightTest("browsertype-connect.spec.ts", "should be able to reconnect to a browser")]
58        public async Task ShouldBeAbleToReconnectToABrowser()
59        {
60            {
61                var browser = await BrowserType.ConnectAsync(_remoteServer.WSEndpoint);
62                var browserContext = await browser.NewContextAsync();
63                Assert.AreEqual(browserContext.Pages.Count, 0);
64                var page = await browserContext.NewPageAsync();
65                Assert.AreEqual(await page.EvaluateAsync<int>("11 * 11"), 121);
66                await page.GotoAsync(Server.EmptyPage);
67                await browser.CloseAsync();
68            }
69            {
70                var browser = await BrowserType.ConnectAsync(_remoteServer.WSEndpoint);
71                var browserContext = await browser.NewContextAsync();
72                var page = await browserContext.NewPageAsync();
73                await page.GotoAsync(Server.EmptyPage);
74                await browser.CloseAsync();
75            }
76        }
77
78        [PlaywrightTest("browsertype-connect.spec.ts", "should send default User-Agent and X-Playwright-Browser headers with connect request")]
79        public async Task ShouldSendDefaultUserAgentAndPlaywrightBrowserHeadersWithConnectRequest()
80        {
81            var connectionRequest = Server.WaitForWebSocketConnectionRequest();
82            BrowserType.ConnectAsync($"ws://localhost:{Server.Port}/ws", new()
83            {
84                Headers = new Dictionary<string, string>()
85                {
86                    ["hello-foo"] = "i-am-bar",
87                }
88            }).IgnoreException();
89            var request = await connectionRequest;
90            StringAssert.Contains("Playwright", request.Headers["User-Agent"]);
91            Assert.AreEqual(request.Headers["hello-foo"], "i-am-bar");
92            Assert.AreEqual(request.Headers["x-playwright-browser"], BrowserType.Name);
93        }
94
95        [PlaywrightTest("browsertype-connect.spec.ts", "should be able to connect two browsers at the same time")]
96        public async Task ShouldBeAbleToConnectTwoBrowsersAtTheSameTime()
97        {
98            var browser1 = await BrowserType.ConnectAsync(_remoteServer.WSEndpoint);
99            Assert.AreEqual(browser1.Contexts.Count, 0);
100            await browser1.NewContextAsync();
101            Assert.AreEqual(browser1.Contexts.Count, 1);
102
103            var browser2 = await BrowserType.ConnectAsync(_remoteServer.WSEndpoint);
104            Assert.AreEqual(browser2.Contexts.Count, 0);
105            await browser2.NewContextAsync();
106            Assert.AreEqual(browser2.Contexts.Count, 1);
107            Assert.AreEqual(browser1.Contexts.Count, 1);
108
109            await browser1.CloseAsync();
110            Assert.AreEqual(browser2.Contexts.Count, 1);
111
112            var page2 = await browser2.NewPageAsync();
113            Assert.AreEqual(await page2.EvaluateAsync<int>("7 * 6"), 42); // original browser should still work
114
115            await browser2.CloseAsync();
116        }
117
118        [PlaywrightTest("browsertype-connect.spec.ts", "should timeout in connect while connecting")]
119        [Skip(SkipAttribute.Targets.Windows)]
120        public async Task ShouldTimeoutInConnectWhileConnecting()
121        {
122            var exception = await PlaywrightAssert.ThrowsAsync<TimeoutException>(async () => await BrowserType.ConnectAsync($"ws://localhost:{Server.Port}/ws", new BrowserTypeConnectOptions { Timeout = 100 }));
123            StringAssert.Contains("BrowserType.ConnectAsync: Timeout 100ms exceeded", exception.Message);
124        }
125
126        [PlaywrightTest("browsertype-connect.spec.ts", "should support slowmo option")]
127        public async Task ShouldSupportSlowMo()
128        {
129            var browser = await BrowserType.ConnectAsync(_remoteServer.WSEndpoint, new BrowserTypeConnectOptions { SlowMo = 200 });
130            var start = DateTime.Now;
131            var context = await browser.NewContextAsync();
132            await browser.CloseAsync();
133            Assert.Greater((DateTime.Now - start).TotalMilliseconds, 199);
134        }
135
136        [PlaywrightTest("browsertype-connect.spec.ts", "disconnected event should be emitted when browser is closed or server is closed")]
137        public async Task DisconnectedEventShouldBeEmittedWhenBrowserIsClosedOrServerIsClosed()
138        {
139            var browser1 = await BrowserType.ConnectAsync(_remoteServer.WSEndpoint);
140            await browser1.NewPageAsync();
141
142            var browser2 = await BrowserType.ConnectAsync(_remoteServer.WSEndpoint);
143            await browser2.NewPageAsync();
144
145            int disconnected1 = 0;
146            int disconnected2 = 0;
147            browser1.Disconnected += (_, e) => disconnected1++;
148            browser2.Disconnected += (_, e) => disconnected2++;
149
150            var tsc1 = new TaskCompletionSource<object>();
151            browser1.Disconnected += (_, e) => tsc1.SetResult(null);
152            await browser1.CloseAsync();
153            await tsc1.Task;
154            Assert.AreEqual(disconnected1, 1);
155            Assert.AreEqual(disconnected2, 0);
156
157            var tsc2 = new TaskCompletionSource<object>();
158            browser2.Disconnected += (_, e) => tsc2.SetResult(null);
159            await browser2.CloseAsync();
160            await tsc2.Task;
161            Assert.AreEqual(disconnected1, 1);
162            Assert.AreEqual(disconnected2, 1);
163        }
164
165        [PlaywrightTest("browsertype-connect.spec.ts", "disconnected event should have browser as argument")]
166        public async Task DisconnectedEventShouldHaveBrowserAsArguments()
167        {
168            var browser = await BrowserType.ConnectAsync(_remoteServer.WSEndpoint);
169            IBrowser disconneced = null;
170            var tsc = new TaskCompletionSource<object>();
171            browser.Disconnected += (_, browser) =>
172            {
173                disconneced = browser;
174                tsc.SetResult(null);
175            };
176            await browser.CloseAsync();
177            await tsc.Task;
178            Assert.AreEqual(browser, disconneced);
179        }
180
181        [PlaywrightTest("browsertype-connect.spec.ts", "should set the browser connected state")]
182        public async Task ShouldSetTheBrowserConnectedState()
183        {
184            var browser = await BrowserType.ConnectAsync(_remoteServer.WSEndpoint);
185            Assert.AreEqual(browser.IsConnected, true);
186            var tsc = new TaskCompletionSource<bool>();
187            browser.Disconnected += (_, e) => tsc.SetResult(false);
188            _remoteServer.Close();
189            await tsc.Task;
190            Assert.AreEqual(browser.IsConnected, false);
191        }
192
193        [PlaywrightTest("browsertype-connect.spec.ts", "should throw when used after isConnected returns false")]
194        public async Task ShouldThrowWhenUsedAfterIsConnectedReturnsFalse()
195        {
196            var browser = await BrowserType.ConnectAsync(_remoteServer.WSEndpoint);
197            var page = await browser.NewPageAsync();
198            var tsc = new TaskCompletionSource<bool>();
199            browser.Disconnected += (_, e) => tsc.SetResult(false);
200            _remoteServer.Close();
201            await tsc.Task;
202            Assert.AreEqual(browser.IsConnected, false);
203            var exception = await PlaywrightAssert.ThrowsAsync<PlaywrightException>(async () => await page.EvaluateAsync("1 + 1"));
204            StringAssert.Contains("has been closed", exception.Message);
205        }
206
207        [PlaywrightTest("browsertype-connect.spec.ts", "should throw when calling waitForNavigation after disconnect")]
208        public async Task ShouldThrowWhenWhenCallingWaitForNavigationAfterDisconnect()
209        {
210            var browser = await BrowserType.ConnectAsync(_remoteServer.WSEndpoint);
211            var page = await browser.NewPageAsync();
212            var tsc = new TaskCompletionSource<bool>();
213            browser.Disconnected += (_, e) => tsc.SetResult(false);
214            _remoteServer.Close();
215            await tsc.Task;
216
217            Assert.AreEqual(browser.IsConnected, false);
218            var exception = await PlaywrightAssert.ThrowsAsync<PlaywrightException>(async () => await page.WaitForNavigationAsync());
219            StringAssert.Contains("Navigation failed because page was closed", exception.Message);
220        }
221
222        [PlaywrightTest("browsertype-connect.spec.ts", "should reject navigation when browser closes")]
223        public async Task ShouldRejectNavigationWhenBrowserCloses()
224        {
225            Server.SetRoute("/one-style.css", context =>
226            {
227                context.Response.Redirect("/one-style.css");
228                return Task.CompletedTask;
229            });
230
231            var browser = await BrowserType.ConnectAsync(_remoteServer.WSEndpoint);
232            var page = await browser.NewPageAsync();
233            var PageGoto = page.GotoAsync(Server.Prefix + "/one-style.html", new PageGotoOptions { Timeout = 60000 });
234            await Server.WaitForRequest("/one-style.css");
235            await browser.CloseAsync();
236
237            Assert.AreEqual(browser.IsConnected, false);
238            var exception = await PlaywrightAssert.ThrowsAsync<PlaywrightException>(async () => await PageGoto);
239            StringAssert.Contains("has been closed", exception.Message);
240        }
241
242        [PlaywrightTest("browsertype-connect.spec.ts", "should reject waitForSelector when browser closes")]
243        public async Task ShouldRejectWaitForSelectorWhenBrowserCloses()
244        {
245            var browser = await BrowserType.ConnectAsync(_remoteServer.WSEndpoint);
246            var page = await browser.NewPageAsync();
247            var watchdog = page.WaitForSelectorAsync("div");
248            await browser.CloseAsync();
249
250            var exception = await PlaywrightAssert.ThrowsAsync<PlaywrightException>(async () => await watchdog);
251            Assert.That(exception.Message, Contains.Substring("has been closed"));
252        }
253
254        [PlaywrightTest("browsertype-connect.spec.ts", "should emit close events on pages and contexts")]
255        public async Task ShouldEmitCloseEventsOnPagesAndContexts()
256        {
257            var browser = await BrowserType.ConnectAsync(_remoteServer.WSEndpoint);
258            var context = await browser.NewContextAsync();
259            var tsc = new TaskCompletionSource<object>();
260            context.Close += (_, e) => tsc.SetResult(null);
261            var page = await context.NewPageAsync();
262            bool pageClosed = false;
263            page.Close += (_, e) => pageClosed = true;
264
265            _remoteServer.Close();
266            await tsc.Task;
267            Assert.AreEqual(pageClosed, true);
268        }
269
270        [PlaywrightTest("browsertype-connect.spec.ts", "should terminate network waiters")]
271        public async Task ShouldTerminateNetworkWaiters()
272        {
273            var browser = await BrowserType.ConnectAsync(_remoteServer.WSEndpoint);
274            var page = await browser.NewPageAsync();
275            var requestWatchdog = page.WaitForRequestAsync(Server.EmptyPage);
276            var responseWatchog = page.WaitForResponseAsync(Server.EmptyPage);
277            _remoteServer.Close();
278            async Task CheckTaskHasException(Task task)
279            {
280                var exception = await PlaywrightAssert.ThrowsAsync<PlaywrightException>(async () => await task);
281                StringAssert.Contains("Page closed", exception.Message);
282                StringAssert.DoesNotContain("Timeout", exception.Message);
283
284            }
285            await CheckTaskHasException(requestWatchdog);
286            await CheckTaskHasException(responseWatchog);
287        }
288
289        [PlaywrightTest("browsertype-connect.spec.ts", "should not throw on close after disconnect")]
290        public async Task ShouldNotThrowOnCloseAfterDisconnect()
291        {
292            var browser = await BrowserType.ConnectAsync(_remoteServer.WSEndpoint);
293            var page = await browser.NewPageAsync();
294
295            var tcs = new TaskCompletionSource<bool>();
296            browser.Disconnected += (_, e) => tcs.SetResult(true);
297            _remoteServer.Close();
298            await tcs.Task;
299            await browser.CloseAsync();
300        }
301
302        [PlaywrightTest("browsertype-connect.spec.ts", "should not throw on context.close after disconnect")]
303        public async Task ShouldNotThrowOnContextCloseAfterDisconnect()
304        {
305            var browser = await BrowserType.ConnectAsync(_remoteServer.WSEndpoint);
306            var context = await browser.NewContextAsync();
307            await context.NewPageAsync();
308
309            var tcs = new TaskCompletionSource<bool>();
310            browser.Disconnected += (_, e) => tcs.SetResult(true);
311            _remoteServer.Close();
312            await tcs.Task;
313            await context.CloseAsync();
314        }
315
316        [PlaywrightTest("browsertype-connect.spec.ts", "should not throw on page.close after disconnect")]
317        public async Task ShouldNotThrowOnPageCloseAfterDisconnect()
318        {
319            var browser = await BrowserType.ConnectAsync(_remoteServer.WSEndpoint);
320            var context = await browser.NewContextAsync();
321            var page = await context.NewPageAsync();
322
323            var tcs = new TaskCompletionSource<bool>();
324            browser.Disconnected += (_, e) => tcs.SetResult(true);
325            _remoteServer.Close();
326            await tcs.Task;
327            await page.CloseAsync();
328        }
329
330        [PlaywrightTest("browsertype-connect.spec.ts", "should saveAs videos from remote browser")]
331        public async Task ShouldSaveAsVideosFromRemoteBrowser()
332        {
333            using var tempDirectory = new TempDirectory();
334            var videoPath = tempDirectory.Path;
335            var browser = await BrowserType.ConnectAsync(_remoteServer.WSEndpoint);
336            var context = await browser.NewContextAsync(new()
337            {
338                RecordVideoDir = videoPath,
339                RecordVideoSize = new() { Height = 320, Width = 240 }
340            });
341
342            var page = await context.NewPageAsync();
343            await page.EvaluateAsync("() => document.body.style.backgroundColor = 'red'");
344            await Task.Delay(1000);
345            await context.CloseAsync();
346
347            var videoSavePath = tempDirectory.Path + "my-video.webm";
348            await page.Video.SaveAsAsync(videoSavePath);
349            Assert.That(videoSavePath, Does.Exist);
350
351            var exception = await PlaywrightAssert.ThrowsAsync<PlaywrightException>(async () => await page.Video.PathAsync());
352            StringAssert.Contains("Path is not available when connecting remotely. Use SaveAsAsync() to save a local copy", exception.Message);
353        }
354
355
356        [PlaywrightTest("browsertype-connect.spec.ts", "should save download")]
357        public async Task ShouldSaveDownload()
358        {
359            Server.SetRoute("/download", context =>
360            {
361                context.Response.Headers["Content-Type"] = "application/octet-stream";
362                context.Response.Headers["Content-Disposition"] = "attachment";
363                return context.Response.WriteAsync("Hello world");
364            });
365
366            var browser = await BrowserType.ConnectAsync(_remoteServer.WSEndpoint);
367            var page = await browser.NewPageAsync(new() { AcceptDownloads = true });
368            await page.SetContentAsync($"<a href=\"{Server.Prefix}/download\">download</a>");
369            var downloadTask = page.WaitForDownloadAsync();
370
371            await TaskUtils.WhenAll(
372                downloadTask,
373                page.ClickAsync("a"));
374
375            using var tmpDir = new TempDirectory();
376            string userPath = Path.Combine(tmpDir.Path, "these", "are", "directories", "download.txt");
377            var download = downloadTask.Result;
378            await download.SaveAsAsync(userPath);
379            Assert.True(new FileInfo(userPath).Exists);
380            Assert.AreEqual("Hello world", File.ReadAllText(userPath));
381            var exception = await PlaywrightAssert.ThrowsAsync<PlaywrightException>(() => download.PathAsync());
382            Assert.AreEqual("Path is not available when connecting remotely. Use SaveAsAsync() to save a local copy.", exception.Message);
383            await browser.CloseAsync();
384        }
385
386        [PlaywrightTest("browsertype-connect.spec.ts", "should error when saving download after deletion")]
387        public async Task ShouldErrorWhenSavingDownloadAfterDeletion()
388        {
389            Server.SetRoute("/download", context =>
390            {
391                context.Response.Headers["Content-Type"] = "application/octet-stream";
392                context.Response.Headers["Content-Disposition"] = "attachment";
393                return context.Response.WriteAsync("Hello world");
394            });
395
396            var browser = await BrowserType.ConnectAsync(_remoteServer.WSEndpoint);
397            var page = await browser.NewPageAsync(new() { AcceptDownloads = true });
398            await page.SetContentAsync($"<a href=\"{Server.Prefix}/download\">download</a>");
399            var downloadTask = page.WaitForDownloadAsync();
400
401            await TaskUtils.WhenAll(
402                downloadTask,
403                page.ClickAsync("a"));
404
405            using var tmpDir = new TempDirectory();
406            string userPath = Path.Combine(tmpDir.Path, "download.txt");
407            var download = downloadTask.Result;
408            await download.DeleteAsync();
409            var exception = await PlaywrightAssert.ThrowsAsync<PlaywrightException>(() => download.SaveAsAsync(userPath));
410            StringAssert.Contains("Target page, context or browser has been closed", exception.Message);
411            await browser.CloseAsync();
412        }
413
414        [PlaywrightTest("browsertype-connect.spec.ts", "should save har")]
415        public async Task ShouldSaveHar()
416        {
417            using var tempDirectory = new TempDirectory();
418            var harPath = tempDirectory.Path + "/test.har";
419            var browser = await BrowserType.ConnectAsync(_remoteServer.WSEndpoint);
420            var context = await browser.NewContextAsync(new()
421            {
422                RecordHarPath = harPath
423            });
424
425            var page = await context.NewPageAsync();
426            await page.GotoAsync(Server.EmptyPage);
427            await context.CloseAsync();
428            await browser.CloseAsync();
429
430            Assert.That(harPath, Does.Exist);
431            var logString = System.IO.File.ReadAllText(harPath);
432            StringAssert.Contains(Server.EmptyPage, logString);
433        }
434
435        [PlaywrightTest("browsertype-connect.spec.ts", "should record trace with sources")]
436        public async Task ShouldRecordContextTraces()
437        {
438            using var tempDirectory = new TempDirectory();
439            var tracePath = tempDirectory.Path + "/trace.zip";
440            var browser = await BrowserType.ConnectAsync(_remoteServer.WSEndpoint);
441            var context = await browser.NewContextAsync();
442            var page = await context.NewPageAsync();
443
444            await context.Tracing.StartAsync(new() { Sources = true });
445            await page.GotoAsync(Server.EmptyPage);
446            await page.SetContentAsync("<button>Click</button>");
447            await page.ClickAsync("button");
448            await context.Tracing.StopAsync(new TracingStopOptions { Path = tracePath });
449
450            await browser.CloseAsync();
451
452            Assert.That(tracePath, Does.Exist);
453            ZipFile.ExtractToDirectory(tracePath, tempDirectory.Path);
454            Assert.That(tempDirectory.Path + "/trace.trace", Does.Exist);
455            Assert.That(tempDirectory.Path + "/trace.network", Does.Exist);
456            Assert.AreEqual(1, Directory.GetFiles(Path.Join(tempDirectory.Path, "resources"), "*.txt").Length);
457        }
458
459        [PlaywrightTest("browsertype-connect.spec.ts", "should upload large file")]
460        [Skip(SkipAttribute.Targets.Firefox, SkipAttribute.Targets.Webkit)]
461        public async Task ShouldUploadLargeFile()
462        {
463            var browser = await BrowserType.ConnectAsync(_remoteServer.WSEndpoint);
464            var context = await browser.NewContextAsync();
465            var page = await context.NewPageAsync();
466
467            await page.GotoAsync(Server.Prefix + "/input/fileupload.html");
468            using var tmpDir = new TempDirectory();
469            var filePath = Path.Combine(tmpDir.Path, "200MB");
470            using (var stream = File.OpenWrite(filePath))
471            {
472                var str = new string('a', 4 * 1024);
473                for (var i = 0; i < 50 * 1024; i++)
474                {
475                    await stream.WriteAsync(Encoding.UTF8.GetBytes(str));
476                }
477            }
478            var input = page.Locator("input[type=file]");
479            var events = await input.EvaluateHandleAsync(@"e => {
480                const events = [];
481                e.addEventListener('input', () => events.push('input'));
482                e.addEventListener('change', () => events.push('change'));
483                return events;
484            }");
485            await input.SetInputFilesAsync(filePath);
486            Assert.AreEqual(await input.EvaluateAsync<string>("e => e.files[0].name"), "200MB");
487            Assert.AreEqual(await events.EvaluateAsync<string[]>("e => e"), new[] { "input", "change" });
488
489            var (file0Name, file0Size) = await TaskUtils.WhenAll(
490               Server.WaitForRequest("/upload", request => (request.Form.Files[0].FileName, request.Form.Files[0].Length)),
491               page.ClickAsync("input[type=submit]")
492            );
493            Assert.AreEqual("200MB", file0Name);
494            Assert.AreEqual(200 * 1024 * 1024, file0Size);
495        }
496
497        private class RemoteServer
498        {
499            private Process Process { get; set; }
500            public string WSEndpoint { get; set; }
501
502            internal RemoteServer(string browserName)
503            {
504                try
505                {
506                    var startInfo = new ProcessStartInfo(Driver.GetExecutablePath(), $"launch-server --browser {browserName}")
507                    {
508                        UseShellExecute = false,
509                        RedirectStandardOutput = true,
510                    };
511                    foreach (var pair in Driver.GetEnvironmentVariables())
512                    {
513                        startInfo.EnvironmentVariables[pair.Key] = pair.Value;
514                    }
515                    Process = new()
516                    {
517                        StartInfo = startInfo,
518                    };
519                    Process.Start();
520                    WSEndpoint = Process.StandardOutput.ReadLine();
521
522                    if (WSEndpoint != null && !WSEndpoint.StartsWith("ws://"))
523                    {
524                        throw new PlaywrightException("Invalid web socket address: " + WSEndpoint);
525                    }
526                }
527                catch (IOException ex)
528                {
529                    throw new PlaywrightException("Failed to launch server", ex);
530                }
531            }
532
533            internal void Close()
534            {
535                Process.Kill(true);
536                Process.WaitForExit();
537                WSEndpoint = null;
538            }
539        }
540    }
541}
542
Full Screen

Accelerate Your Automation Test Cycles With LambdaTest

Leverage LambdaTest’s cloud-based platform to execute your automation tests in parallel and trim down your test execution time significantly. Your first 100 automation testing minutes are on us.

Try LambdaTest
LambdaTestX

We use cookies to give you the best experience. Cookies help to provide a more personalized experience and relevant advertising for you, and web analytics for us. Learn More in our Cookies policy, Privacy & Terms of service

Allow Cookie
Sarah

I hope you find the best code examples for your project.

If you want to accelerate automated browser testing, try LambdaTest. Your first 100 automation testing minutes are FREE.

Sarah Elson (Product & Growth Lead)