{"_id":"54c524dcd4928c0d00d98e53","category":{"_id":"54c51db22418480d0028a2c9","version":"54c51c5e2418480d0028a2c3","__v":3,"pages":["54c520202418480d0028a2d4","54c5219a2418480d0028a2d8","54c524dcd4928c0d00d98e53"],"project":"54c51c5e2418480d0028a2c0","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-01-25T16:45:38.112Z","from_sync":false,"order":2,"slug":"page-objects","title":"Page Objects"},"project":"54c51c5e2418480d0028a2c0","githubsync":"","user":"54c4b05742190d0d00f5fbde","version":{"_id":"54c51c5e2418480d0028a2c3","__v":4,"project":"54c51c5e2418480d0028a2c0","createdAt":"2015-01-25T16:39:58.382Z","releaseDate":"2015-01-25T16:39:58.382Z","categories":["54c51c5e2418480d0028a2c4","54c51da3796aed0d009fc80f","54c51db22418480d0028a2c9","54c51dbd1613c70d00eeacbe"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1.0"},"__v":3,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2015-01-25T17:16:12.905Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"auth":"required","params":[],"url":""},"isReference":false,"order":999,"body":"## Element Finder\nFinds Selenium IWebElement items on the page, using the Selenium By selectors or the Seleno jQuery selectors. Page Objects expose the Element Finder class with the `Find` property.\n\n var selector = string.Format(\"$('#{0} option:selected')\", Id);\n return Find.Element(By.jQuery(selector), WaitInSecondsUntilElementAvailable);\n\n## Navigation\nA great way to slow down your tests is to start each test on the home page and then navigate to the page you want to test! It's much better to navigate directly to the page that you want to test. You can do this by calling the NavigateToInitialPage method on SelenoHost instance and passing in the *relative* URL (to the root of the site being tested) or an absolute URL.\n\n var page = <AnInstanceOfSelenoHost>\n .NavigateToInitialPage<RegisterPage>(\"/Account/Register\");\n\nIn addition, if you are using ASP.NET MVC then you can also use strongly typed controller action expressions to navigate to the page via routing. \n\n var page = <AnInstanceOfSelenoHost>\n .NavigateToInitialPage<AccountController, RegisterPage>(x => x.Register());\n\nIf you are using these MVC expressions, just remember to register the application routes when you are initializing Seleno.\n\n <AnInstanceOfSelenoHost>\n .Run(\"MvcMusicStore\", 12345, \n c => c.WithRouteConfig(MvcApplication.RegisterRoutes(RouteTable.Routes)));","excerpt":"","slug":"locators","type":"basic","title":"Locators"}

Configuration

Page Objects

Locators

## Element Finder
Finds Selenium IWebElement items on the page, using the Selenium By selectors or the Seleno jQuery selectors. Page Objects expose the Element Finder class with the `Find` property.
var selector = string.Format("$('#{0} option:selected')", Id);
return Find.Element(By.jQuery(selector), WaitInSecondsUntilElementAvailable);
## Navigation
A great way to slow down your tests is to start each test on the home page and then navigate to the page you want to test! It's much better to navigate directly to the page that you want to test. You can do this by calling the NavigateToInitialPage method on SelenoHost instance and passing in the *relative* URL (to the root of the site being tested) or an absolute URL.
var page = <AnInstanceOfSelenoHost>
.NavigateToInitialPage<RegisterPage>("/Account/Register");
In addition, if you are using ASP.NET MVC then you can also use strongly typed controller action expressions to navigate to the page via routing.
var page = <AnInstanceOfSelenoHost>
.NavigateToInitialPage<AccountController, RegisterPage>(x => x.Register());
If you are using these MVC expressions, just remember to register the application routes when you are initializing Seleno.
<AnInstanceOfSelenoHost>
.Run("MvcMusicStore", 12345,
c => c.WithRouteConfig(MvcApplication.RegisterRoutes(RouteTable.Routes)));