EnVisageOnline/Main/TestSystem/Prevu/Selenium/ProjectScenariosPage.cs

41 lines
1.2 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using OpenQA.Selenium;
using System.Collections;
namespace Prevu
{
public class ProjectScenariosPage : BasePage
{
By txtName = By.Id("Name");
By tabActive = By.ClassName("active");
By btnPlus = By.ClassName("fa-plus-square");
WebDriver _driver;
public ProjectScenariosPage(WebDriver driver)
{
_driver = driver;
}
public bool OpenProjectScenarios(string scenarioId, string tabName)
{
_driver.OpenPage(string.Format("Scenarios/Details/{0}", scenarioId));
_driver.WaitElement(txtName);
_driver.ClickLink(tabName);
IList<IWebElement> plusButtons = _driver.GetElements(btnPlus);
foreach (IWebElement plusButton in plusButtons)
{
plusButton.Click();
_driver.WaitAjax();
}
IWebElement activeTab = _driver.GetElement(tabActive);
return activeTab.Text == tabName;
}
}
}