используя Систему;
используя System.Text;
using System.Collections.Generic;
использование System.Linq;
использование Microsoft.VisualStudio.TestTools.UnitTesting;
использование System.Text.RegularExpressions;
используя System.Threading;
с использованием селена;
namespace Search1
{
[TestClass]
public class SearchTest1
{
public SearchTest1()
{
}
private TestContext testContextInstance;
/// <summary>
///Gets or sets the test context which provides
///information about and functionality for the current test run.
///</summary>
public TestContext TestContext
{
get
{
return testContextInstance;
}
set
{
testContextInstance = value;
}
}
private ISelenium selenium;
[TestMethod]
public void SearchMethod1()
{
selenium = new DefaultSelenium("localhost", 4444, "*iexplore", "http://localhost/crm.aspx");
selenium.Start();
selenium.Open("/crm/SearchPage.aspx?function=3");
selenium.WaitForPageToLoad("30000");
Assert.IsTrue(selenium.IsTextPresent("Select All | Clear All"));
try
{
Assert.IsTrue(selenium.IsTextPresent("Select All | Clear All"));
}
catch (Exception)
{
}
selenium.Click("//span[@onclick=\"fnCheckGroupWithMessage('You have selected all items.', 'cbxRepeater_');\"]");
Assert.AreEqual("'You have selected all items.", selenium.GetAlert());
decimal totalCheckboxes = selenium.GetXpathCount("//input[@type='checkbox']");
for (int i = 1; i < totalCheckboxes + 1; i++)
{
Assert.IsTrue(selenium.IsChecked("//input[@type='checkbox'][" + i + "]"));
}
}
}
}
Тестовый метод Search1.SearchTest1.SearchMethod1 выдал исключение:
Selenium.SeleniumException: ОШИБКА: Элемент // input [@ type = 'checkbox'] [2] не найден