我正在测试一个需要个人SSL证书的网站才能做某些事情,比如登录.
我有一个使用代理设置的Webdriver(Selenium 2.0)测试:
Proxy localhostProxy = new Proxy();
localhostProxy.setProxyType(Proxy.ProxyType.MANUAL);
localhostProxy.setHttpProxy("www-proxyname:port");
FirefoxProfile profile = new FirefoxProfile();
profile.setProxyPreferences(localhostProxy);
driver = new FirefoxDriver(profile);
Run Code Online (Sandbox Code Playgroud)
这将很好地访问主页.然后,测试点击登录按钮,输入正确的凭据并单击提交.此时浏览器进入加载状态,我假设是因为我的身边缺少SSL证书,因此无法连接到登录服务.
我搜索了不同的代理解决方案,发现了这个:
profile.setAcceptUntrustedCertificates(true);
profile.setAssumeUntrustedCertificateIssuer(true);
Run Code Online (Sandbox Code Playgroud)
所以我把它添加到我的代码中,但它似乎没有做我想要的.我想我正在寻找一种方法告诉WebDriver我的ssl证书在x目录中,请在访问此站点时使用它.有谁知道如何做到这一点?
我的测试代码是:
@Test
public void userSignsInAndVerifiesDrawerViews(){
driver.get("www.url.com");
waitFor(5000);
driver.findElement(By.xpath("//a[contains(text(), 'Sign in')]")).click();
waitFor(3000);
String username = "seleniumtest";
String password = "seleniumtest1";
driver.findElement(By.id("username")).sendKeys(username);
driver.findElement(By.id("password")).sendKeys(password);
driver.findElement(By.xpath("//signin")).click();
waitFor(30000);
String signInLinkText = driver.findElement(By.xpath("//xpath")).getText();
assertEquals(signInLinkText, username);
}
Run Code Online (Sandbox Code Playgroud)
谢谢,贝西
我正在使用JB Evain的Mono.Cecil对已编译的DLL执行一些字节码操作.该项目的一部分是将属性注入TypeDefinitions,使用PropertyDefinitions有效地将编译的getter/setter转换为C#Properties模式.这部分运作良好.
但是,我想在TypeDefinition中添加一个索引器,但是我找不到任何关于如何最好地实现此目的的文档或建议.将用于处理索引请求的方法已经到位:
Object getObjectViaIndexer(String str);
void setObjectViaIndexer(String str, object obj);
Run Code Online (Sandbox Code Playgroud)
我需要做的就是添加元数据以将它们转换为索引器....
任何想法/想法都会非常高兴!