-
-
Notifications
You must be signed in to change notification settings - Fork 2
PageCollection
AutoWeb uses a PageCollection object to add and manage your pages.
// Creates a default page collection. (uses msedgedriver)
new PageCollection();
// Creates a page collection with configured options. You may also use the static method
// mentioned further down in the documentation.
new PageCollection(options => {
// Option #1
// Option to specify a different browser.
options.Browser<IBrowser>("chromedriver.exe")
// Option #2
// Option to specify all options for the browser
options.Browser<ChromeBrowser>(opts => {
opts.Driver = "chromedriver.exe";
opts.Timeout = new TimeSpan(0, 0, 30);
opts.Arguments = new string[] {
"--headless"
};
});
// At times the driver will remain running in the background, this will
// attempt to clear them before starting a new one.
options.CleanOrphanedDrivers = true,
});Once created you can add pages later or directly off the new object itself. Either of these methods are fine.
new PageCollection()
.AddPage<LoginPage>()
.AddPage<RepositoryPage>();
var pages = new PageCollection();
pages.Add<LoginPage>();Once you have pages added to your collection you can execute them individually, or all in the order they were added.
// This will execute all pages starting at LoginPage and continuing to RepositoryPage
new PageCollection()
.AddPage<LoginPage>()
.AddPage<RepositoryPage>()
.Execute()
// If executing against the variable itself you can execute a singular page.
pages.Execute<LoginPage>();PageCollection has three static methods that are useful if you are using a different browser driver. You can configure the browser without using these methods but these allow for a little easier setup.
The following static method will use all default browser options, however it will attempt to load the driver at the specified path.
PageCollection.Create<IBrowser>(string driver)This one will allow you to specify the driver with a default timeout amount for the browser.
PageCollection.Create<IBrowser>(string driver, TimeSpan timeout)This will allow you to pass all the information above including arguments that get passed directly to the browser on start up.
PageCollection.Create<IBrowser>(string driver, TimeSpan timeout, params string[] arguments)