
这是DefaultSelenium的构造函数:
ISelenium sele = new DefaultSelenium(**serveraddr**,**serverport**,browser,url2test);sele.Start();sele.open();...
似乎我必须在创建ISelenium对象之前安装Selenium Server.
我的情况是,我正在尝试使用C#Selenium构建一个.exe应用程序,它可以在不同的PC上运行,并且不可能在所有PC上安装Selenium Server(你永远不知道哪个是下一个运行应用程序).
有没有人知道如何在不安装服务器的情况下使用ISelenium / DefaultSelenium?
谢谢!
1)对于selenium浏览器启动:
DesiredCapabilitIEs capabilitIEs = new DesiredCapabilitIEs();capabilitIEs.setbrowsername("safari");CommandExecutor executor = new SeleneseCommandExecutor(new URL("http://localhost:4444/"),new URL("http://www.Google.com/"),capabilitIEs);WebDriver driver = new RemoteWebDriver(executor,capabilitIEs); 2)对于selenium命令:
// You may use any WebDriver implementation. firefox is used here as an exampleWebDriver driver = new firefoxDriver();// A "base url",used by selenium to resolve relative URLs String baseUrl = "http://www.Google.com";// Create the Selenium implementationSelenium selenium = new WebDriverBackedSelenium(driver,baseUrl);// Perform actions with seleniumselenium.open("http://www.Google.com");selenium.type("name=q","cheese");selenium.click("name=btnG");// Get the underlying WebDriver implementation back. This will refer to the// same WebDriver instance as the "driver" variable above.WebDriver driverInstance = ((WebDriverBackedSelenium) selenium).getWrappedDriver();//Finally,close the browser. Call stop on the WebDriverBackedSelenium instance//instead of calling driver.quit(). Otherwise,the JVM will continue running after//the browser has been closed.selenium.stop(); 描述于此:http://seleniumhq.org/docs/03_webdriver.html
谷歌在C#中有类似的东西.没有其他方法可以实现这一目标.
总结以上是内存溢出为你收集整理的c# – 是否可以在不安装Selenium Server的情况下使用ISelenium / DefaultSelenium?全部内容,希望文章能够帮你解决c# – 是否可以在不安装Selenium Server的情况下使用ISelenium / DefaultSelenium?所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)