Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
wait for alert to come before accepting it
  • Loading branch information
sriv committed Feb 2, 2016
1 parent 4e9a9ce commit 56b272b
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions Implementation/Pages/ProductPage.cs
@@ -1,8 +1,10 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using Gauge.CSharp.Lib;
using NUnit.Framework;
using OpenQA.Selenium;
using OpenQA.Selenium.Support.PageObjects;
using OpenQA.Selenium.Support.UI;

namespace Gauge.Example.Implementation.Pages
{
Expand Down Expand Up @@ -32,14 +34,9 @@ public class ProductPage : BasePage

public void Delete() {
DeleteButton.Click();
try
{
DriverFactory.Driver.SwitchTo().Alert().Accept();
}
catch (NoAlertPresentException)
{
//headless, no alerts
}
var driver = DriverFactory.Driver;
new WebDriverWait(driver, TimeSpan.FromSeconds(5)).Until(ExpectedConditions.AlertIsPresent());
driver.SwitchTo().Alert().Accept();
}

public void VerifyProductAttribute(string attributeName, string value)
Expand Down

0 comments on commit 56b272b

Please sign in to comment.