我们打算在CRM 2015中实现功能测试的Selenium自动化测试(客户建议,因为它是开源工具),我在Google和不同的搜索引擎中对Selenium for CRM 2015做了很多探索。您能建议/指导我如何在crm 2015中使用硒吗
我想知道为什么它还没有回答,基本上你可以安装nuget包并为你想要自动化的浏览器选择一个web驱动程序。然后编写一个像
这样的控制台应用程序 using OpenQA.Selenium;
using OpenQA.Selenium.IE;
string crmUrl = "http://mycrm.url";
//create a ieAutomation
IWebDriver ieAutomation = new InternetExplorerDriver();//BrowserDriver
// open url
ieAutomation.Navigate().GoToUrl(crmUrl);
// find element by id and set text
ieAutomation.FindElement(By.Id("name")).SendKeys("set the text");
// find element by id and make a click
ieAutomation.FindElement(By.Id("id")).Click();
// close the driver & exit
ieAutomation.Close();
ieAutomation.Quit();
这是一个快速启动教程,你可以在文档中找到更多。虽然作为一个水疗中心,它的设置太贵了,不值得努力,但LEAPTEST声称它很容易,价格。
注意:确保BinDebug文件夹 中有IEDriverServer.exe可用更新2020:回头看这个答案,我发现Sikuli更有用,因为它通过使用图像识别和控制GUI(图形用户界面)组件来识别对象。当无法方便地访问GUI的内部或源代码时,Sikuli是一个不错的选择。
为此,可以添加Nuget引用
<package id="SikuliIntegrator" version="1.1.0" targetFramework="net452" />
你可以将截图保存到一个文件夹,比如在c:\crm
文件夹中,并使用下面的代码:
static void Main(string[] args)
{
SikuliModule.SikuliAction.Click("C:\crm\Sales.png");
SikuliModule.SikuliAction.Click("C:\crm\Accounts.png");
SikuliModule.SikuliAction.Click("C:\crm\New.png");
SikuliModule.SikuliAction.DoubleClick("C:\crm\ParentAccountQ.png");
SikuliModule.SikuliAction.Click("C:\crm\LookupLense.png");
//SikuliModule.SikuliAction.Click()
}
请注意,这可能因操作系统而异。而且配置是我一年半前为php和zend 1编写的。然而,大多数事情不应该有什么不同。
-
确保你有phpunit
-
请确保您有Firefox浏览器。(其他浏览器也可以,但firefox有最好的支持)。
-
到下面的链接下载selenium-remote-control-1.0.3.zip。http://code.google.com/p/selenium/downloads/detail?name=selenium-remote-control-1.0.3.zip&can=2&q=(找不到更新的版本)
-
解压zip文件,进入selenium-remote-control-1.0.3=> selenium-php-client-driver-1.0.1=> PEAR目录,复制"Testing"文件夹,然后粘贴到C:xamppphp文件夹。其余的文件添加到C:。所以它变成了C:selenium-remote-control-1.0.3selenium-server-1.0.3
-
下载Selenium RC服务器http://selenium-release.storage.googleapis.com/index.html?path=2.48/我使用的是2.41版本的独立文件,现在有2.48版本+一些dotnet文件
5.1。要启动服务器,请打开命令提示符或终端,导航到C:selenium-remote-control-1.0.3selenium-server-1.0.3并键入java -jar selenium-server-standalone-2.41.0.jar
5.2。要使服务器运行,需要安装Java并正确配置PATH环境变量,以便从控制台中运行它。您可以通过在控制台上运行以下命令来检查是否正确安装了Java:
java - version如果版本是>= 1.5你可以使用Selenium RC
-
获取Firefox的Selenium IDE并安装http://release.seleniumhq.org/selenium-ide/选择您想要的版本。我当时用的是2.5.0。
-
运行已配置的测试。启动selenium服务器(参见第5.1点),导航到phpunit测试并运行测试。Firefox应该在几秒钟后启动并执行测试。如果出现错误,测试将被终止。
-
要记录您自己的测试,请启动selenium ide并导航到您想要测试的年龄并开始单击。