views:

23

answers:

2

I'm very new to Selenium RC. I'm using .NET (though I don't think it is relevant), I have opened a page, but I want to confirm that the page was actually opened. I have a few ideas like using .Select() or using one of the .get*() methods, but I want to do what is considered the best practice by others in the Selenium community.

A: 

I usually assert some text or element on the page. You most likely don't just want to make sure the page "loaded" you want to make sure it loaded something specific

Marty Trenouth
Thanks for the feedback, Marty. I suppose that I may find someday that you are right and I will not often want to simply know if the page was returned. However, in this case, that is sufficient. In the spirit of simplicity I don't want to be dependent on anything else.
Randy Eppinger
If you dont care, just validate something really really stupid like body or html is present.
Marty Trenouth
A: 

I am currently confirming the page was returned using the following:

[Then(@"the (.*) page should be displayed")]
public void ThenThePageShouldBeDisplayed(string pageName) {
    Assert.IsTrue(selenium.GetLocation().Contains(pageName));
}

This happens to be a SpecFlow test step implementation.

Randy Eppinger