作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试在 Dynamics 365 On-Premise 中使用 EasyRepro 进行自动化 UI 测试。我设法通过一个问题进行了测试,我无法自动登录到我的 Dynamics 365 组织。以下是我使用的代码:
var client = new WebClient(TestSettings.Options);
using (var xrmApp = new XrmApp(client))
{
xrmApp.OnlineLogin.Login(_xrmUri, _username, _password);
xrmApp.Navigation.OpenSubArea("My Work", "Companies");
xrmApp.CommandBar.ClickCommand("New");
xrmApp.Entity.SetValue("name", TestSettings.GetRandomString(5,15));
xrmApp.Entity.Save();
}
最佳答案
此 github issue谈本地CRM实例自动登录脚本的登录部分。
This is how I got around Windows Authentication Login (Could not use the ADFS Login on our On-Premise CRM Install). Just defined the Login elements:
using (var xrmBrowser = new Browser(TestSettings.Options))
{
DateTime dt = DateTime.Now;
String xpath = "//*[@id='search']";
// String logoffcrm = "#navBarUserInfoTextId > span.navTabButtonUserInfoText.navTabButtonUserInfoCompany";
Actions keyAction = new Actions(xrmBrowser.Driver);
xrmBrowser.GoToXrmUri(_xrmUri);
xrmBrowser.Driver.FindElement(By.Id("ContentPlaceHolder1_UsernameTextBox")).SendKeys(_username);
xrmBrowser.ThinkTime(1000);
xrmBrowser.Driver.FindElement(By.Id("ContentPlaceHolder1_PasswordTextBox")).SendKeys(_password);
xrmBrowser.ThinkTime(1000);
try
{
if (_browser == "Chrome")
{
xrmBrowser.Driver.FindElement(By.Id("ContentPlaceHolder1_SubmitButton")).Click();
}
if (_browser == "IE")
{
xrmBrowser.Driver.FindElement(By.Id("ContentPlaceHolder1_SubmitButton")).Submit();
}
xrmBrowser.Driver.WaitUntilVisible(By.XPath(xpath)
, new TimeSpan(0, 0, 60),
e => { xrmBrowser.Driver.WaitForPageToLoad(); },
f => { throw new Exception("Login failed."); });
}
catch (StaleElementReferenceException)
{
//old element has gone
//Console.WriteLine(g);
xrmBrowser.Driver.WaitUntilVisible(By.XPath(xpath)
, new TimeSpan(0, 0, 60),
e => { xrmBrowser.Driver.WaitForPageToLoad(); },
f => { throw new Exception("Login failed."); });
}
关于automated-tests - 如何在内部部署的 Dynamics 365 中使用 EasyRepro 自动登录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60056050/
我正在尝试在 Dynamics 365 On-Premise 中使用 EasyRepro 进行自动化 UI 测试。我设法通过一个问题进行了测试,我无法自动登录到我的 Dynamics 365 组织。以
我是一名优秀的程序员,十分优秀!