我想尝试无头镀铬,但我遇到了这个问题,我无法在无头模式下启动驱动程序.我正在关注谷歌文档.我错过了什么吗?该代码执行陷在var browser = new ChromeDriver();线路
这是我的代码:
var chromeOptions = new ChromeOptions
{
BinaryLocation = @"C:\Users\2-as Aukstas\Documents\Visual Studio 2017\Projects\ChromeTest\ChromeTest\bin\Debug\chromedriver.exe",
DebuggerAddress = "localhost:9222"
};
chromeOptions.AddArguments(new List<string>() {"headless", "disable-gpu" });
var browser = new ChromeDriver(chromeOptions);
browser.Navigate().GoToUrl("https://stackoverflow.com/");
Console.WriteLine(browser.FindElement(By.CssSelector("#h-top-questions")).Text);
Run Code Online (Sandbox Code Playgroud) 是否可以使用ToastNotificationManager从控制台应用程序发送Toast通知?
我知道可以从Windows Universal app发送Toast通知:
var toast = new ToastNotification(doc);
ToastNotificationManager.CreateToastNotifier().Show(toast);
Run Code Online (Sandbox Code Playgroud)
*doc - 存储在XML字符串中的Toast
要使用ToastNotificaionManager,我需要Windows.UI.Notifications库,我无法在控制台应用程序项目中引用它.
我之前提到的库实际上是由WinRT使用的.是否可以在Windows控制台应用程序中使用WinRT API?
c# windows notifications console-application win-universal-app
我目前正在使用此regEx
currentLine = Regex.Replace(currentLine, " {1,} \t \n", @" ");
Run Code Online (Sandbox Code Playgroud)
它似乎没有工作.我需要一个正则表达式,用一个空格替换空格,新行字符,制表符.还有其他空间角色,我应该记住吗?
原始未过滤表
过滤表
我正在尝试使用 Interop.Excel 读取 .xlsx 文件。当我将xlRange变量设置为仅显示过滤后的单元格(可见)时,它似乎有一个奇怪的行为:
Excel.Range xlRange = xlWorksheet.UsedRange.SpecialCells(Excel.XlCellType.xlCellTypeVisible, Type.Missing);
调试:
当表没有过滤时:
xlRange.Count: 15 //表中元素总数
rowCount: 5 //这包括标题
当表被过滤时:
xlRange.Count: 9 //这是正确的
rowCount: 1 //这应该是3(包括标题)
Excel.Application xlApp = new Excel.Application();
Excel.Workbook xlWorkbook = xlApp.Workbooks.Open(Directory.GetCurrentDirectory() + "\\Example.xlsx");
Excel._Worksheet xlWorksheet = xlWorkbook.Sheets[1];
Excel.Range xlRange = xlWorksheet.UsedRange.SpecialCells(Excel.XlCellType.xlCellTypeVisible, Type.Missing);
int rowCount = xlRange.Rows.Count;
int colCount = xlRange.Columns.Count;
//iterate over the rows and columns and print to the console as it appears in the file
//excel is not zero based!!
for …Run Code Online (Sandbox Code Playgroud)