IronPython fail to add reference to WebDriver.dll
在使用Ironpython引用WebDriver程序集做web自动化时碰到这个问题,出问题的代码很简单,如下:
import sys
import clr
clr.AddReferenceToFileAndPath(r"c:\WebDriver.dll")
运行抛出异常,告知无法添加引用
解决方案:
clr的AddReferenceXX系列方法其实就是Assembly.LoadXX系列,可参见链接http://blogs.msdn.com/b/haibo_luo/archive/2007/09/25/5130072.aspx
所以最初的想法是创建一个c#工程然后Assembly.LoadFile之。果不出奇然,抛出异常:
An attempt was made to load an assembly from a network location which would have caused the assembly to be sandboxed in previous versions of the .NET Framework. This release of the .NET Framework does not enable CAS policy by default, so this load may be dangerous. If this load is not intended to sandbox the assembly, please enable the loadFromRemoteSources switch. See http://go.microsoft.com/fwlink/?LinkId=155569 for more information.
单看错误原因表面上是加载了一个网络路径上的dll,可是我的dll是在本地啊,打开kb看到这么一段话:
If an application has been copied from the web, it is flagged by Windows as being a web application, even if it resides on the local computer. You can change that designation by changing the file properties, or you can use the<loadFromRemoteSources> element to grant the assembly full trust. As an alternative, you can use the UnsafeLoadFrom method to load a local assembly that the operating system has flagged as having been loaded from the web.
so查看WebDriver.dll的文件属性,
在最下方Unlock之,在重新运行c#工程和原python代码,问题解决了!
IronPython fail to add reference to WebDriver.dll的更多相关文章
- Failed to add reference to 'System.Net.Http'. Please make sure that it is in the Global Assembly Cache.
关闭VS再来就好了
- Asp.net core 学习笔记 (library)
refer : https://docs.microsoft.com/en-us/dotnet/core/tutorials/library-with-visual-studio https://do ...
- using log4net on my project within a self-hosted WCF application z
Add reference to log4net.dll to our console service host project (our application entry point) Add t ...
- Windows Dll Injection、Process Injection、API Hook、DLL后门/恶意程序入侵技术
catalogue 1. 引言2. 使用注册表注入DLL3. 使用Windows挂钩来注入DLL4. 使用远程线程来注入DLL5. 使用木马DLL来注入DLL6. 把DLL作为调试器来注入7. 使用c ...
- ASP.NET与非托管DLL的那些事儿【转+增】
https://www.cnblogs.com/yeahgis/archive/2011/11/12/2246341.html ASP.NET与非托管DLL的那些事儿 环境VS2010 语言:ISO ...
- .Net中DLL冲突解决(真假美猴王)
<西游记>中真假美猴王让人着实难以区分,但是我们熟知了其中的细节也不难把他们剥去表象分别出来.对问题不太关心的可以直接调到文中关于.Net文件版本的介绍 问题 最近在编译AKKA.net ...
- Embed dll Files Within an exe (C# WinForms)—Winform 集成零散dll进exe的方法
A while back I was working on a small C# WinForms application in Visual Studio 2008. For the sake of ...
- lib和dll的例子
.dll和.lib的区别 lib是静态库,dll一般是动态链接库(也有可能是别的)比如要编译个exe,lib在编译的时候就会被编译到exe里,作为程序的一部分而dll是不被编译进去,是运行的时候才调入 ...
- asp.net中bin目录下的 dll.refresh文件
首先找到了这篇文章http://www.cnblogs.com/haokaibo/archive/2010/07/31/1789342.html 然后找到一篇英文的文章http://monsur.xa ...
随机推荐
- spring配置文件中属性mappingLocations、mappingDirectoryLocations
http://blog.csdn.net/vacblog/article/details/7774173
- ios专题 - openSSL
1 概述 1.1 产生背景 基 于万维网的电子商务和网上银行等新兴应用,极大地方便了人们的日常生活,受到人们的青睐.由于这些应用都需要在网络上进行在线交易,它们对网络通信的安全 性提出了更高的要求 ...
- javascript入门学习笔记2
JavaScript 拥有动态类型.这意味着相同的变量可用作不同的类型: 实例 var x // x 为 undefined var x = 6; // x 为数字 var x = "Bil ...
- 校省选赛第一场D题TwoDecks题解
今天晚上第二场比赛,现在还是赛后刷上次的题目,越刷越伤心,发现我赛后一次AC的功力很强大啊!!!(希望今晚变成是赛中一次AC啊!!) 好啦,回归正题. 看题目 D. Merging Two Decks ...
- window FILES——windows文件管理相关实例
C语言下有一套文件管理方案.C++语言下也有一套自己的文件管理方案.windows系统当然也有自己的一套文件管理方案啦.对于普通char类型为基础的字符使用哪种方案的解决办法都是一样的,但是对于宽字符 ...
- Codeforces 551E - GukiZ and GukiZiana(分块)
Problem E. GukiZ and GukiZiana Solution: 先分成N=sqrt(n)块,然后对这N块进行排序. 利用二分查找确定最前面和最后面的位置. #include < ...
- win8.1磁盘使用率100解决方法
关闭家庭组,因为这功能会导致硬盘和CPU处于高负荷状态.关闭方法:Win+C – 设置 – 更改电脑设置 – 家庭组 – 离开如果用不到家庭组可以直接把家庭组服务也给关闭了:控制面板 – 管理工具 – ...
- TreeList
1.获取当前被选中的节点数据 string tmp = treeL.FocusedNode.GetDisplayText(this.treeListColumnIndex); 2.是否允许编辑 tre ...
- 最近采用Instruments
最近采用Instruments 来分析整个应用程序的性能.发现很多有意思的点,以及性能优化和一些分析性能消耗的技巧,小结如下. Instruments使用技巧 关于Instruments官方有一个很有 ...
- shell编程的一些例子1
1.$0-$9及$# $@的使用 demo_arg 内容 #!/bin/bash echo "程序名:$0" echo "命令传递参数个数:$#" echo & ...