在本文中,我们将为您详细介绍如何启动使用逻辑应用程序运行SeleniumWeb驱动程序的控制台应用程序?的相关知识,此外,我们还会提供一些关于.NETCore2.1以下的控制台应用程序生成EXE,且使
在本文中,我们将为您详细介绍如何启动使用逻辑应用程序运行Selenium Web驱动程序的控制台应用程序?的相关知识,此外,我们还会提供一些关于.NET Core 2.1 以下的控制台应用程序生成 EXE,且使用命令行参数动态运行控制器应用程序的示例、asp.net – 在.net中使用selenium 2.0 web驱动程序的示例/教程?、c# – 如何将控制台应用程序更改为Windows窗体应用程序?、c# – 如何重新启动控制台应用程序?的有用信息。
本文目录一览:- 如何启动使用逻辑应用程序运行Selenium Web驱动程序的控制台应用程序?
- .NET Core 2.1 以下的控制台应用程序生成 EXE,且使用命令行参数动态运行控制器应用程序的示例
- asp.net – 在.net中使用selenium 2.0 web驱动程序的示例/教程?
- c# – 如何将控制台应用程序更改为Windows窗体应用程序?
- c# – 如何重新启动控制台应用程序?
如何启动使用逻辑应用程序运行Selenium Web驱动程序的控制台应用程序?
这是不可能的。硒需要使用App Service Sandbox中不允许的GDI +。似乎更可行的措施是您正在做的事情,在构建代理上的CI / CD流程中运行Selenium测试。
.NET Core 2.1 以下的控制台应用程序生成 EXE,且使用命令行参数动态运行控制器应用程序的示例
文章:
https://stackoverflow.com/questions/44038847/vs2017-compile-netcoreapp-as-exe
引用
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.CommandLineUtils" Version="1.1.1" />
<PackageReference Include="System.Collections.NonGeneric" Version="4.3.0" />
</ItemGroup>
Program.cs
using Microsoft.Extensions.CommandLineUtils;
namespace EnumerableSample
{
class Program
{
static void Main(string[] args)
{
var app = new CommandLineApplication(throwOnUnexpectedArg: false);
app.FullName = "LINQ Sample App";
LinqSamples.Register(app);
FilteringSamples.Register(app);
GroupingSamples.Register(app);
CompoundFromSamples.Register(app);
JoinSamples.Register(app);
SortingSamples.Register(app);
app.Command("help", cmd =>
{
cmd.Description = "Get help for the application";
CommandArgument commandArgument = cmd.Argument("<COMMAND>", "The command to get help for");
cmd.OnExecute(() =>
{
app.ShowHelp(commandArgument.Value);
return 0;
});
});
app.OnExecute(() =>
{
app.ShowHelp();
return 0;
});
app.Execute(args);
}
}
}
LinqSamples.cs
using Microsoft.Extensions.CommandLineUtils;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
namespace EnumerableSample
{
internal class LinqSamples
{
internal static void Register(CommandLineApplication app)
{
MethodInfo[] methods = Assembly.GetExecutingAssembly()
.GetTypes()
.Where(t => t.Name == nameof(LinqSamples))
.Single()
.GetMethods()
.Where(m => m.IsPublic && m.IsStatic)
.ToArray();
foreach (var method in methods)
{
app.Command(method.Name.ToLower(), cmd =>
{
cmd.Description = method.Name;
cmd.OnExecute(() => { method.Invoke(null, null); return 0; });
});
}
}
public static void GenerateRange()
{
var values = Enumerable.Range(1, 20);
foreach (var item in values)
{
Console.Write($"{item} ", item);
}
Console.WriteLine();
}
}
}
FilteringSamples.cs
using DataLib;
using Microsoft.Extensions.CommandLineUtils;
using System;
using System.Linq;
namespace EnumerableSample
{
public class FilteringSamples
{
internal static void Register(CommandLineApplication app)
{
app.Command("filter", cmd =>
{
var invokeMethodOption = new CommandOption("-m", CommandOptionType.NoValue);
var indexOption = new CommandOption("-i", CommandOptionType.NoValue);
var typeOption = new CommandOption("-t", CommandOptionType.NoValue);
cmd.Options.AddRange(new[] { invokeMethodOption, indexOption, typeOption });
cmd.Description = "filter -[m|i|t]";
cmd.OnExecute(() =>
{
if (invokeMethodOption.HasValue())
{
FilteringWithMethods();
}
else if (indexOption.HasValue())
{
FilteringWithIndex();
}
else if (typeOption.HasValue())
{
TypeFiltering();
}
else
{
Filtering();
}
return 0;
});
});
}
public static void Filtering()
{
var racers = from r in Formula1.GetChampions()
where r.Wins > 15 && (r.Country == "Brazil" || r.Country == "Austria")
select r;
foreach (var r in racers)
{
Console.WriteLine($"{r:A}");
}
}
public static void FilteringWithIndex()
{
var racers = Formula1.GetChampions()
.Where((r, index) => r.LastName.StartsWith("A") && index % 2 != 0);
foreach (var r in racers)
{
Console.WriteLine($"{r:A}");
}
}
public static void FilteringWithMethods()
{
var racers = Formula1.GetChampions()
.Where(r => r.Wins > 15 && (r.Country == "Brazil" || r.Country == "Austria"));
foreach (var r in racers)
{
Console.WriteLine($"{r:A}");
}
}
public static void TypeFiltering()
{
object[] data = { "one", 2, 3, "four", "five", 6 };
var query = data.OfType<string>();
foreach (var s in query)
{
Console.WriteLine(s);
}
}
}
}
运行截图:
谢谢浏览!
asp.net – 在.net中使用selenium 2.0 web驱动程序的示例/教程?
我试过搜索,但只能找到java,没有关于.net和selenium 2.0 web驱动程序
解决方法
http://seleniumhq.org/docs/03_webdriver.html
using OpenQA.Selenium.Firefox; using OpenQA.Selenium; class GoogleSuggest { static void Main(string[] args) { IWebDriver driver = new FirefoxDriver(); //Notice navigation is slightly different than the Java version //This is because 'get' is a keyword in C# driver.Navigate().GoToUrl("http://www.google.com/"); IWebElement query = driver.FindElement(By.Name("q")); query.SendKeys("Cheese"); System.Console.WriteLine("Page title is: " + driver.Title); driver.Quit(); } }
c# – 如何将控制台应用程序更改为Windows窗体应用程序?
Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new UI());
这样的作品,但原来的控制台窗口依然存在.
我已经搜索了一些像this这样的有用的信息,但是他们所做的一切都是在创建窗口之后杀死了窗口,而不是解决问题的根源.那么还有更优雅的方式来做到这一点吗?
解决方法
c# – 如何重新启动控制台应用程序?
我有这个
Console.WriteLine(message,"Rebuild Log Files" + " Press Enter to finish,or R to restar the program..."); string restar = Console.ReadLine(); if(restar.toupper() == "R") { //here the code to restart the console... }
谢谢
解决方法
今天关于如何启动使用逻辑应用程序运行Selenium Web驱动程序的控制台应用程序?的讲解已经结束,谢谢您的阅读,如果想了解更多关于.NET Core 2.1 以下的控制台应用程序生成 EXE,且使用命令行参数动态运行控制器应用程序的示例、asp.net – 在.net中使用selenium 2.0 web驱动程序的示例/教程?、c# – 如何将控制台应用程序更改为Windows窗体应用程序?、c# – 如何重新启动控制台应用程序?的相关知识,请在本站搜索。
本文标签: