private async void Button_Click_9(object sender, RoutedEventArgs e) { var userDir = tbOpenProfileDir.Text; try { if (chbOpenProfileHeadless.IsChecked == true) { var width = 1200; var height = 900; int.TryParse(tbOpenProfileHeadlessWidth.Text, out width); int.TryParse(tbOpenProfileHeadlessHeight.Text, out height); asyncChromeDriver = new AsyncChromeDriver(new ChromeDriverConfig().SetHeadless().SetWindowSize(width, height).SetUserDir(userDir)); } else { asyncChromeDriver = new AsyncChromeDriver(userDir); } webDriver = new WebDriver(asyncChromeDriver); await asyncChromeDriver.Connect(); // browser opens here // await webDriver.GoToUrl("https://www.google.com/"); // browser opens here var mess = $"opened on port {asyncChromeDriver.Port} in dir {asyncChromeDriver.UserDir} \nWhen close, dir will NOT be deleted"; tbDevToolsRes.Text = mess; tbDevToolsRes2.Text = mess; } catch (Exception ex) { tbDevToolsRes.Text = ex.ToString(); tbDevToolsRes2.Text = ex.ToString(); } }
private async void OpenTab_Button_Click(object sender, RoutedEventArgs e) { try { var addArgs = tbOpenAddArgs.Text; if (chbOpenProfileHeadless.IsChecked == true) { var width = 1200; var height = 900; int.TryParse(tbOpenProfileHeadlessWidth.Text, out width); int.TryParse(tbOpenProfileHeadlessHeight.Text, out height); var config = new ChromeDriverConfig().SetHeadless().SetWindowSize(width, height).SetIsTempProfile(); if (!string.IsNullOrWhiteSpace(addArgs)) { config.SetCommandLineArgumets(addArgs); } asyncChromeDriver = new AsyncChromeDriver(config); } else { asyncChromeDriver = string.IsNullOrWhiteSpace(addArgs) ? new AsyncChromeDriver() : new AsyncChromeDriver(new ChromeDriverConfig().SetCommandLineArgumets(addArgs)); } webDriver = new WebDriver(asyncChromeDriver); await asyncChromeDriver.Connect(); tbDevToolsRes2.Text = $"opened on port {asyncChromeDriver.Port} in dir {asyncChromeDriver.UserDir} \nWhen close, dir will be DELETED"; } catch (Exception ex) { tbDevToolsRes2.Text = ex.ToString(); } }
private async void Button_Click_22(object sender, RoutedEventArgs e) { var dir = tbDevToolsFilesDir.Text; if (string.IsNullOrWhiteSpace(dir)) { dir = Directory.GetCurrentDirectory(); } dir = dir.TrimEnd('\\'); if (dir.EndsWith("\\devtools")) { dir = Path.GetDirectoryName(dir); } try { asyncChromeDriver = new AsyncChromeDriver( new ChromeDriverConfig() .SetDoOpenBrowserDevTools() .SetWSProxyConfig(new ChromeWSProxyConfig { DevToolsFilesDir = dir, HttpServerTryFindRequestedFileLocaly = true }) ); webDriver = new WebDriver(asyncChromeDriver); await asyncChromeDriver.Connect(); tbDevToolsRes.Text = "opened"; } catch (Exception ex) { tbDevToolsRes.Text = ex.ToString(); } }
private async void Button_Click_17(object sender, RoutedEventArgs e) { var acd = new AsyncChromeDriver(); browsersToClose.Add(acd); await acd.Connect(); await acd.Navigation.GoToUrl(asyncChromeDriver.GetBrowserDevToolsUrl()); }
private async void Button_Click_15(object sender, RoutedEventArgs e) { var drv1 = new AsyncChromeDriver(); var drv2 = new AsyncChromeDriver(); driversToClose.Add(drv1); driversToClose.Add(drv2); await drv1.Connect(); await drv2.Connect(); await drv2.Navigation.GoToUrl("http://www.google.co.uk"); }
private async void Button_Click_15(object sender, RoutedEventArgs e) { asyncChromeDriver = new AsyncChromeDriver(new ChromeDriverConfig().SetDoOpenWSProxy()); webDriver = new WebDriver(asyncChromeDriver); await webDriver.Open(); //chromeProcess = await asyncChromeDriver.OpenChromeProfile(asyncChromeDriver.Config); //asyncChromeDriver.DevTools = new Zu.Chrome.BrowserDevTools.ChromeDevToolsConnectionProxy(14392, wsProxyConfig: asyncChromeDriver.Config.WSProxyConfig); //asyncChromeDriver.isConnected = true; //await asyncChromeDriver.DevTools.Connect(); asyncChromeDriverDev = new AsyncChromeDriver(); await asyncChromeDriverDev.Connect(); await asyncChromeDriverDev.Navigation.GoToUrl(asyncChromeDriver.GetBrowserDevToolsUrl()); }
private async void OpenTab_Button_Click(object sender, RoutedEventArgs e) { try { asyncChromeDriver = new AsyncChromeDriver(); webDriver = new WebDriver(asyncChromeDriver); await asyncChromeDriver.Connect(); tbDevToolsRes2.Text = $"opened on port {asyncChromeDriver.Port} in dir {asyncChromeDriver.UserDir} \nWhen close, dir will be DELETED"; } catch (Exception ex) { tbDevToolsRes2.Text = ex.ToString(); } }
private async void Button_Click_19(object sender, RoutedEventArgs e) { try { asyncChromeDriver = new AsyncChromeDriver(new ChromeDriverConfig().SetDoOpenBrowserDevTools()); asyncChromeDriver.BrowserDevToolsConfig = new ChromeDriverConfig().SetDoOpenBrowserDevTools(); webDriver = new WebDriver(asyncChromeDriver); await asyncChromeDriver.Connect(); tbDevToolsRes.Text = "opened"; } catch (Exception ex) { tbDevToolsRes.Text = ex.ToString(); } }
private async void Button_Click_14(object sender, RoutedEventArgs e) { try { asyncChromeDriver = new AsyncChromeDriver(new ChromeDriverConfig().SetDoOpenWSProxy().SetPort(14392)); webDriver = new WebDriver(asyncChromeDriver); await asyncChromeDriver.Connect(); tbDevToolsRes.Text = "opened"; tbDevToolsRes2.Text = $"opened on port {asyncChromeDriver.Port} in dir {asyncChromeDriver.UserDir} \nWhen close, dir will be DELETED"; } catch (Exception ex) { tbDevToolsRes.Text = ex.ToString(); tbDevToolsRes2.Text = ex.ToString(); } }
private async void Button_Click_22(object sender, RoutedEventArgs e) { try { asyncChromeDriver = new AsyncChromeDriver(new ChromeDriverConfig().SetDoOpenBrowserDevTools()); asyncChromeDriver.BrowserDevToolsConfig = new ChromeDriverConfig().SetDoOpenBrowserDevTools(); browsersToClose.Add(asyncChromeDriver); webDriver = new WebDriver(asyncChromeDriver); await asyncChromeDriver.Connect(); AddInfo("opened"); } catch (Exception ex) { AddInfo(ex.ToString()); } }
private async Task OpenChrome(ChromeDriverConfig chromeDriverConfig) { try { if (webDriver != null) { await webDriver.Close(); } asyncChromeDriver = new AsyncChromeDriver(chromeDriverConfig); browsersToClose.Add(asyncChromeDriver); webDriver = new WebDriver(asyncChromeDriver); await asyncChromeDriver.Connect(); AddInfo($"opened on port {asyncChromeDriver.Port} in dir {asyncChromeDriver.UserDir} \nWhen close, dir will be DELETED"); } catch (Exception ex) { AddInfo(ex.ToString()); } }
private async void Button_Click_21(object sender, RoutedEventArgs e) { try { asyncChromeDriver = new AsyncChromeDriver( new ChromeDriverConfig() .SetDoOpenBrowserDevTools() .SetWSProxyConfig(new ChromeWSProxyConfig { HttpServerSaveRequestedFiles = true }) ); webDriver = new WebDriver(asyncChromeDriver); await asyncChromeDriver.Connect(); tbDevToolsFilesDir.Text = Path.Combine(asyncChromeDriver.Config.WSProxyConfig.DevToolsFilesDir, "devtools"); tbDevToolsRes.Text = "opened"; } catch (Exception ex) { tbDevToolsRes.Text = ex.ToString(); } }