forked from SeleniumHQ/selenium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathObjectStateAssumptionsTest.cs
52 lines (48 loc) · 1.55 KB
/
ObjectStateAssumptionsTest.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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
using System;
using System.Collections.Generic;
using System.Text;
using NUnit.Framework;
using System.Collections.ObjectModel;
namespace OpenQA.Selenium
{
[TestFixture]
public class ObjectStateAssumptionsTest : DriverTestFixture
{
[Test]
public void UninitializedWebDriverDoesNotThrowException()
{
variousMethodCallsToCheckAssumptions();
}
/**
* This test case differs from @see testUninitializedWebDriverDoesNotThrowNPE as it initializes
* WebDriver with an initial call to get(). It also should not fail.
*/
[Test]
public void InitializedWebDriverDoesNotThrowException()
{
driver.Url = simpleTestPage;
variousMethodCallsToCheckAssumptions();
}
/**
* Test the various options, again for an uninitialized driver, NPEs are thrown.
*/
[Test]
public void OptionsForUninitializedWebDriverDoesNotThrowException()
{
IOptions options = driver.Manage();
ReadOnlyCollection<Cookie> allCookies = options.Cookies.AllCookies;
}
/**
* Add the various method calls you want to try here...
*/
private void variousMethodCallsToCheckAssumptions()
{
string currentUrl = driver.Url;
string currentTitle = driver.Title;
string pageSource = driver.PageSource;
By byHtml = By.XPath("//html");
driver.FindElement(byHtml);
driver.FindElements(byHtml);
}
}
}