0% found this document useful (0 votes)
97 views2 pages

Firstone

This document defines a test class for automated testing of a Dynamics CRM application. The test class initializes a ChromeDriver, navigates to the CRM URL, logs in with provided username and password, and switches to a frame before clicking a button to create a new app. It also defines a method to check if an element is present.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
97 views2 pages

Firstone

This document defines a test class for automated testing of a Dynamics CRM application. The test class initializes a ChromeDriver, navigates to the CRM URL, logs in with provided username and password, and switches to a frame before clicking a button to create a new app. It also defines a method to check if an element is present.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

using System;

using System.Threading;
using System.Collections;
using System.Collections.Generic;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
using OpenQA.Selenium.Support.UI;
using System.Collections.ObjectModel;
using SeleniumExtras.WaitHelpers;
using OpenQA.Selenium.Interactions;
using OpenQA.Selenium.IE;
using OpenQA.Selenium.Edge;
using ExpectedConditions = SeleniumExtras.WaitHelpers.ExpectedConditions;

namespace UnitTestProject3
{

[TestClass]
public class UnitTest1
{
private const string url =
"https://ktestsg890tp2patorg122.crm10.dynamics.com/apps";
private const string userId = "[email protected]";
private const string password = "Sep@2017";

TimeSpan timeOut = TimeSpan.FromSeconds(100);


[TestInitialize]
[TestMethod]
public void TestMethod1()
{
IWebDriver webDriver = new ChromeDriver();
webDriver.Manage().Window.Maximize();
WebDriverWait wait = new WebDriverWait(webDriver, timeOut);
//signin to crm
webDriver.Navigate().GoToUrl(url);

wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementIsVisible(By.Id("i0
116")));
webDriver.FindElement(By.Id("i0116")).SendKeys(userId);

wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementToBeClickable(By.Id
("idSIButton9")));
webDriver.FindElement(By.Id("idSIButton9")).Click();

wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementIsVisible(By.Id("i0
118")));
webDriver.FindElement(By.Id("i0118")).SendKeys(password);

wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementToBeClickable(By.Id
("idSIButton9")));
webDriver.FindElement(By.Id("idSIButton9")).Click();

wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementIsVisible((By.XPath
("//*[@id=\"idSIButton9\"]")))).Click();

wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.TitleIs(webDriver.Title));
webDriver.SwitchTo().Frame("AppLandingPage");
webDriver.FindElement(By.Id("app-create-new-app-button")).Click();
}
public Boolean isElementPresent(IWebDriver webDriver, By by)
{
try
{
webDriver.FindElement(by);
return true;
}
catch (NoSuchElementException)
{
return false;
}
}
}
}

You might also like