Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions dotnet/test/remote/RemoteWebDriverSpecificTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,25 +63,25 @@ public void ShouldBeAbleToCreateRemoteWebDriverWithNoSlashAtEndOfUri()
[Test]
public void ShouldBeAbleToSendFileToRemoteServer()
{
IAllowsFileDetection fileDetectionDriver = driver as IAllowsFileDetection;
IAllowsFileDetection fileDetectionDriver = Driver as IAllowsFileDetection;
if (fileDetectionDriver == null)
{
Assert.That(driver, Is.InstanceOf<IAllowsFileDetection>(), "driver does not support file detection. This should not be");
Assert.That(Driver, Is.InstanceOf<IAllowsFileDetection>(), "driver does not support file detection. This should not be");
}

fileDetectionDriver.FileDetector = new LocalFileDetector();

driver.Url = Urls.UploadPage;
IWebElement uploadElement = driver.FindElement(By.Id("upload"));
Driver.Url = Urls.UploadPage;
IWebElement uploadElement = Driver.FindElement(By.Id("upload"));
uploadElement.SendKeys(testFile.FullName);
driver.FindElement(By.Id("go")).Submit();
Driver.FindElement(By.Id("go")).Submit();

driver.SwitchTo().Frame("upload_target");
Driver.SwitchTo().Frame("upload_target");

IWebElement body = driver.FindElement(By.XPath("//body"));
Assert.That(body.Text, Is.EqualTo(LoremIpsumText), "Page source is: " + driver.PageSource);
driver.SwitchTo().DefaultContent();
uploadElement = driver.FindElement(By.Id("upload"));
IWebElement body = Driver.FindElement(By.XPath("//body"));
Assert.That(body.Text, Is.EqualTo(LoremIpsumText), "Page source is: " + Driver.PageSource);
Driver.SwitchTo().DefaultContent();
uploadElement = Driver.FindElement(By.Id("upload"));
Console.WriteLine(uploadElement.Text);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ public class EventFiringWebDriverElementTests : DriverTestFixture
[SetUp]
public void Setup()
{
driver.Url = Urls.FormsPage;
Driver.Url = Urls.FormsPage;
}

[Test]
public void CanTakeEventFiringWebElementScreenshot()
{
var firingDriver = new EventFiringWebDriver(driver);
var firingDriver = new EventFiringWebDriver(Driver);
IWebElement element = firingDriver.FindElement(By.Name("checky"));
Screenshot screenshot = ((ITakesScreenshot)element).GetScreenshot();

Expand Down
60 changes: 30 additions & 30 deletions dotnet/test/support/UI/PopupWindowFinderTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,74 +28,74 @@ public class PopupWindowFinderTests : DriverTestFixture
[Test]
public void ShouldFindPopupWindowUsingAction()
{
driver.Url = Urls.XhtmlTestPage;
string current = driver.CurrentWindowHandle;
Driver.Url = Urls.XhtmlTestPage;
string current = Driver.CurrentWindowHandle;

PopupWindowFinder finder = new PopupWindowFinder(driver);
string newHandle = finder.Invoke(() => { driver.FindElement(By.LinkText("Open new window")).Click(); });
PopupWindowFinder finder = new PopupWindowFinder(Driver);
string newHandle = finder.Invoke(() => { Driver.FindElement(By.LinkText("Open new window")).Click(); });

Assert.That(newHandle, Is.Not.Null.And.Not.Empty);
Assert.That(newHandle, Is.Not.EqualTo(current));

driver.SwitchTo().Window(newHandle);
Assert.That(driver.Title, Is.EqualTo("We Arrive Here"));
driver.Close();
Driver.SwitchTo().Window(newHandle);
Assert.That(Driver.Title, Is.EqualTo("We Arrive Here"));
Driver.Close();

driver.SwitchTo().Window(current);
Driver.SwitchTo().Window(current);
}

[Test]
public void ShouldFindPopupWindowUsingElementClick()
{
driver.Url = Urls.XhtmlTestPage;
string current = driver.CurrentWindowHandle;
Driver.Url = Urls.XhtmlTestPage;
string current = Driver.CurrentWindowHandle;

PopupWindowFinder finder = new PopupWindowFinder(driver);
string newHandle = finder.Click(driver.FindElement(By.LinkText("Open new window")));
PopupWindowFinder finder = new PopupWindowFinder(Driver);
string newHandle = finder.Click(Driver.FindElement(By.LinkText("Open new window")));

Assert.That(newHandle, Is.Not.Null.And.Not.Empty);
Assert.That(newHandle, Is.Not.EqualTo(current));

driver.SwitchTo().Window(newHandle);
Assert.That(driver.Title, Is.EqualTo("We Arrive Here"));
driver.Close();
Driver.SwitchTo().Window(newHandle);
Assert.That(Driver.Title, Is.EqualTo("We Arrive Here"));
Driver.Close();

driver.SwitchTo().Window(current);
Driver.SwitchTo().Window(current);
}

[Test]
public void ShouldFindMultiplePopupWindowsInSuccession()
{
driver.Url = Urls.XhtmlTestPage;
string first = driver.CurrentWindowHandle;
Driver.Url = Urls.XhtmlTestPage;
string first = Driver.CurrentWindowHandle;

PopupWindowFinder finder = new PopupWindowFinder(driver);
string second = finder.Click(driver.FindElement(By.Name("windowOne")));
PopupWindowFinder finder = new PopupWindowFinder(Driver);
string second = finder.Click(Driver.FindElement(By.Name("windowOne")));
Assert.That(second, Is.Not.Null.And.Not.Empty);
Assert.That(second, Is.Not.EqualTo(first));

finder = new PopupWindowFinder(driver);
string third = finder.Click(driver.FindElement(By.Name("windowTwo")));
finder = new PopupWindowFinder(Driver);
string third = finder.Click(Driver.FindElement(By.Name("windowTwo")));
Assert.That(third, Is.Not.Null.And.Not.Empty);
Assert.That(third, Is.Not.EqualTo(first));
Assert.That(third, Is.Not.EqualTo(second));

driver.SwitchTo().Window(second);
driver.Close();
Driver.SwitchTo().Window(second);
Driver.Close();

driver.SwitchTo().Window(third);
driver.Close();
Driver.SwitchTo().Window(third);
Driver.Close();

driver.SwitchTo().Window(first);
Driver.SwitchTo().Window(first);
}

[Test]
public void ShouldNotFindPopupWindowWhenNoneExists()
{
driver.Url = Urls.XhtmlTestPage;
PopupWindowFinder finder = new PopupWindowFinder(driver);
Driver.Url = Urls.XhtmlTestPage;
PopupWindowFinder finder = new PopupWindowFinder(Driver);
Assert.That(
() => finder.Click(driver.FindElement(By.Id("linkId"))),
() => finder.Click(Driver.FindElement(By.Id("linkId"))),
Throws.TypeOf<WebDriverTimeoutException>());
}
}
Loading
Loading