■ ■ ■ ■ ■ ■
Src/ES.Taipan.Infrastructure/Network/SeleniumDriver.fs
| skipped 182 lines |
183 | 183 | | _driver.Value.Quit() |
184 | 184 | | |
185 | 185 | | member this.ExecuteScript(httpRequest: HttpRequest, scriptSrc: String, args: Object) = |
186 | | - | let a = GC.GetTotalMemory(true) |
187 | 186 | | lock _syncRoot (fun () -> |
188 | 187 | | let mutable result: Dictionary<String, Object> option = None |
189 | 188 | | let urlData = Uri.UnescapeDataString(httpRequest.Source.Value.DocumentHtml) |
| skipped 63 lines |
253 | 252 | | |
254 | 253 | | // some unknow error :\ |
255 | 254 | | result.Value.["error"] <- "Unknow error" |
| 255 | + | result.Value.["html"] <- String.Empty |
| 256 | + | result.Value.["output"] <- new Dictionary<String, Object>() |
256 | 257 | | executionCompleted <- true |
257 | 258 | | with |
258 | 259 | | | :? UnhandledAlertException as e -> |
| skipped 17 lines |
276 | 277 | | // save a screenshot if specified |
277 | 278 | | if this.TakeScreenShot then |
278 | 279 | | let screenshot = _driver.Value.GetScreenshot() |
279 | | - | let filename = Guid.NewGuid().ToString("N") |
280 | | - | screenshot.SaveAsFile(filename, OpenQA.Selenium.ScreenshotImageFormat.Gif) |
281 | | - | result.Value.["gif"] <- File.ReadAllBytes(filename) |
282 | | - | File.Delete(filename) |
| 280 | + | result.Value.["gif"] <- screenshot.AsByteArray |
283 | 281 | | |
284 | 282 | | // add cookies |
285 | 283 | | let cookies = new List<System.Net.Cookie>() |
| skipped 13 lines |
299 | 297 | | with _ as ex -> |
300 | 298 | | _log?Exception(ex.Message, ex.StackTrace) |
301 | 299 | | |
302 | | - | Console.WriteLine("Used memory: {0}", GC.GetTotalMemory(true) - a) |
303 | 300 | | result |
304 | 301 | | ) |
305 | 302 | | |
| skipped 3 lines |