当我尝试在Chrome中运行测试时出错:
初始化方法AutomationUsingSelenium.SmuladorChrome.MyTestInitialize抛出异常.OpenQA.Selenium.DriverServiceNotFoundException:OpenQA.Selenium.DriverServiceNotFoundException
原因是什么?
我收到一个错误:
文件功能[BrowserName =,IsJavaScriptEnabled = False,Platform = Any,Version =]\IEDriverServer.exe不存在.该驱动程序可以从http://code.google.com/p/ selenium/ downloads / list` 下载
我该怎么做才能解决这个错误,因为我真的找不到信息....
我有以下代码,基本上创建一个DynamicAssembly有两种类型,每种类型都有一个公共方法.
var assembly = AppDomain.CurrentDomain.DefineDynamicAssembly
(new AssemblyName("TestAssembly"), AssemblyBuilderAccess.Run);
var module = assembly.DefineDynamicModule("Main");
var type1 = module.DefineType("type1");
var method1 = type1.DefineMethod
(
"Method1", MethodAttributes.Public, typeof(void), null
);
var gen = method1.GetILGenerator();
gen.Emit(OpCodes.Ret);
var t1 = type1.CreateType();
var createdMethod1 = t1.GetMethod("Method1");
var type2 = module.DefineType("type2");
var method2 = type2.DefineMethod
(
"Method2", MethodAttributes.Public, typeof(void), null
);
byte[] ilCodes = new byte[5];
ilCodes[0] = (byte)OpCodes.Jmp.Value;
ilCodes[1] = (byte)(createdMethod1.MetadataToken & 0xFF);
ilCodes[2] = (byte)(createdMethod1.MetadataToken >> 8 & 0xFF);
ilCodes[3] = (byte)(createdMethod1.MetadataToken >> 16 & 0xFF); …Run Code Online (Sandbox Code Playgroud) 我创建了几个虚拟导演,我希望能够从当前的http请求中获取url.
例如:
http://www.site.com/app_1/default.aspx ===> http://www.site.com/app_1/
http://www.site.com/app_2/default.aspx ===> http://www.site.com/app_2/
....
http://www.site.com/app_n/default.aspx ===> http://www.site.com/app_n/
我的代码:
string urlApp = HttpContext.Current.Request.Url.AbsoluteUri.ToString();
urlApp = urlApp.Substring(0, urlApp.LastIndexOf('/') + 1);
Run Code Online (Sandbox Code Playgroud)
我试过
string urlApp = HttpContext.Current.Request.Url.GetLeftPart(UriPartial.Authority) + "/";
Run Code Online (Sandbox Code Playgroud)
在localhost中工作得很好:http://localhost:2468/test.aspx结果http://localhost:2468/
,但是当通过虚拟目录访问http://myhost/app_1/test.aspx结果时http://myhost/
我怎么能得到http://myhost/app_1/?