forked from SeleniumHQ/selenium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTestImplicitLocators.cs
25 lines (24 loc) · 1.04 KB
/
TestImplicitLocators.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
using System;
using System.Collections.Generic;
using System.Text;
using NUnit.Framework;
namespace Selenium.Tests
{
[TestFixture]
public class TestImplicitLocators : SeleniumTestCaseBase
{
[Test]
public void ShouldBeAbleToUseImplicitLocators()
{
selenium.Open("../tests/html/test_locators.html");
Assert.AreEqual("this is the first element", selenium.GetText("id1"));
Assert.AreEqual("a1", selenium.GetAttribute("id1@class"));
Assert.AreEqual("this is the second element", selenium.GetText("name1"));
Assert.AreEqual("a2", selenium.GetAttribute("name1@class"));
Assert.AreEqual("this is the second element", selenium.GetText("document.links[1]"));
Assert.AreEqual("a2", selenium.GetAttribute("document.links[1]@class"));
Assert.AreEqual("banner", selenium.GetAttribute("//img[contains(@src, 'banner.gif')]/@alt"));
Assert.AreEqual("this is the second element", selenium.GetText("//body/a[2]"));
}
}
}