本文整理汇总了C#中OpenQA.Selenium.Remote.RemoteWebDriver.FinallyQuitGuard方法的典型用法代码示例。如果您正苦于以下问题:C# RemoteWebDriver.FinallyQuitGuard方法的具体用法?C# RemoteWebDriver.FinallyQuitGuard怎么用?C# RemoteWebDriver.FinallyQuitGuard使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OpenQA.Selenium.Remote.RemoteWebDriver
的用法示例。
在下文中一共展示了RemoteWebDriver.FinallyQuitGuard方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ShouldPresentLicenseList
public static void ShouldPresentLicenseList( RemoteWebDriver driver, AuthenticatingNavigator navigator )
{
using ( driver.FinallyQuitGuard() ) // TODO improve this using http://xunit.codeplex.com/workitem/9798 ( WAS: http://xunit.codeplex.com/discussions/362097 )
{
navigator.NavigateWithAuthenticate( driver, "" );
WebDriverWait wait = new WebDriverWait( driver, TimeSpan.FromSeconds( 5 ) );
wait.Until( d => driver.Title.Equals( "Licenses" ) );
}
}
示例2: ShouldIncludeAtLeastOneLicense
public static void ShouldIncludeAtLeastOneLicense( RemoteWebDriver driver, AuthenticatingNavigator navigator )
{
using ( driver.FinallyQuitGuard() ) // TODO improve this using http://xunit.codeplex.com/workitem/9798 ( WAS: http://xunit.codeplex.com/discussions/362097 )
{
navigator.NavigateWithAuthenticate( driver, "license" );
// Even when cold, 5 seconds is a long time to wait
WebDriverWait wait = new WebDriverWait( driver, TimeSpan.FromSeconds( 5 ) );
wait.Until( d => driver.FindElementsByCssSelector( "#licenses tr" ).Count > 0 );
}
}
示例3: ShouldIncludeAtLeastOneCustomer
public static void ShouldIncludeAtLeastOneCustomer( RemoteWebDriver driver, AuthenticatingNavigator navigator )
{
using ( driver.FinallyQuitGuard() ) // TODO improve this using http://xunit.codeplex.com/workitem/9798 ( WAS: http://xunit.codeplex.com/discussions/362097 )
{
navigator.NavigateWithAuthenticate( driver, "Sp.Web.Consume/customer" );
// If we cannot respond in 5 seconds for any reason, a human will seriously distrust the software, no excuses
WebDriverWait wait = new WebDriverWait( driver, TimeSpan.FromSeconds( 5 ) );
wait.Until( d => d
.FindElement( By.Id( "customers" ) )
.FindElements( By.TagName( "tr" ) )
.Count > 0 );
}
}
示例4: ShouldContainCustomerUsername
public static void ShouldContainCustomerUsername( RemoteWebDriver driver, AuthenticatingNavigator navigator )
{
using ( driver.FinallyQuitGuard() ) // TODO improve this using http://xunit.codeplex.com/workitem/9798 ( WAS: http://xunit.codeplex.com/discussions/362097 )
{
navigator.NavigateWithAuthenticate( driver, "" );
WebDriverWait wait = new WebDriverWait( driver, TimeSpan.FromSeconds( 5 ) );
var userSettingsMenu = wait.Until( d => driver.FindElementByCssSelector( "button[name='settings']" ) );
userSettingsMenu.Click();
var usernameElement = wait.Until( d => driver.FindElementByCssSelector( "li[id='username']" ) );
Assert.Contains( ConfigurationManager.AppSettings[ "PortalUsername" ], usernameElement.Text );
}
}
示例5: SignoffShouldRedirectToHostRoot
public static void SignoffShouldRedirectToHostRoot( RemoteWebDriver driver, AuthenticatingNavigator navigator )
{
using ( driver.FinallyQuitGuard() ) // TODO improve this using http://xunit.codeplex.com/workitem/9798 ( WAS: http://xunit.codeplex.com/discussions/362097 )
{
navigator.NavigateWithAuthenticate( driver, "" );
WebDriverWait wait = new WebDriverWait( driver, TimeSpan.FromSeconds( 5 ) );
var userSettingsMenu = wait.Until( d => driver.FindElementByCssSelector( "button[name='settings']" ) );
userSettingsMenu.Click();
var logoffButton = wait.Until( d => driver.FindElementByCssSelector( "a[name='logoff']" ) );
var portalUrl = new Uri( driver.Url );
logoffButton.Click();
var signoffLandingUrl = new Uri( driver.Url );
Assert.Equal( portalUrl.Authority, signoffLandingUrl.Authority );
}
}
示例6: DeletesAndAddsShouldBeEvidentOnRefresh
static void DeletesAndAddsShouldBeEvidentOnRefresh( RemoteWebDriver driver, AuthenticatingNavigator navigator )
{
using ( driver.FinallyQuitGuard() ) // TODO improve this using http://xunit.codeplex.com/workitem/9798 ( WAS: http://xunit.codeplex.com/discussions/362097 )
{
navigator.NavigateWithAuthenticate( driver, "tag" );
// Once the 'Add New Tag' button becomes enabled, we know that all tags have been loaded
WebDriverWait shortWait = new WebDriverWait( driver, TimeSpan.FromSeconds( 2 ) );
shortWait.Until( d => d.FindElement( By.Id( "add_new_tag" ) ).Enabled );
//TODO TP 1650 - an enabled 'Add New Tag' button doesn't guarantee that the rendering is finished in Chrome; doing some unconditional wait...
Thread.Sleep( 1000 );
// Delete all except the first (if there is one)
foreach ( IWebElement item in driver.FindElements( By.CssSelector( "button.delete" ) ).Skip( 1 ) )
item.Click();
shortWait.Until( d => d.FindElements( By.CssSelector( "input.tag_name" ) ).Count <= 1 );
// Add a fresh one; give it a name
driver.FindElement( By.Id( "add_new_tag" ) ).Click();
var newTagInputElement = driver.FindElements( By.CssSelector( "input.tag_name" ) ).Last();
newTagInputElement.Clear();
newTagInputElement.Click();
var newTagName = new Fixture().CreateAnonymous<string>();
newTagInputElement.SendKeys( newTagName );
string[] tagsAsSubmitted = SaveAndRecordSubmittedTags( driver );
// Need a retry in case the initial load loads data which does not include the (eventually consistent) changes
new WebDriverWaitIgnoringNestedTimeouts( driver, TimeSpan.FromSeconds( 7 ) ).Until( _ =>
{
driver.Navigate().Refresh();
// Verify reloading the page shows the same tags pretty quickly
return shortWait.Until( d =>
d.FindElement( By.Id( "add_new_tag" ) ).Enabled
&& tagsAsSubmitted.SequenceEqual( d.FindElements( By.CssSelector( "input.tag_name" ) ).Select( tagNameEl => tagNameEl.GetAttribute( "value" ).Trim() ) ) );
} );
}
}
示例7: CreateCustomerShouldSucceed
public static void CreateCustomerShouldSucceed( RemoteWebDriver driver, AuthenticatingNavigator navigator )
{
using ( driver.FinallyQuitGuard() ) // TODO improve this using http://xunit.codeplex.com/workitem/9798 ( WAS: http://xunit.codeplex.com/discussions/362097 )
{
navigator.NavigateWithAuthenticate( driver, "Sp.Web.Consume/Customer/Create" );
WebDriverWait wait = new WebDriverWait( driver, TimeSpan.FromSeconds( 5 ) );
wait.Until( d => d.FindElement( By.Id( "create-view" ) ) );
IWebElement nameElement = driver.FindElement( By.Id( "name" ) );
string anonymousCustomerName = "anonymousName" + Guid.NewGuid();
nameElement.SendKeys( anonymousCustomerName );
IWebElement externalIdElement = driver.FindElement( By.Id( "externalId" ) );
externalIdElement.SendKeys( "anonymousExternalId" );
IWebElement createButton = driver.FindElement( By.Id( "add-customer" ) );
createButton.Click();
wait.Until( d => d
.FindElement( By.Id( "messages" ) )
.Text.Contains( "Customer created successfully" ) );
}
}