I am working in automated test using specflow scenario feature files and steps to execute . i got stucked in executing scenario for cancel print dialog box in chrome.
Scenario:User can get report
When I select 'All ' tab
And I click on Report Icon to preview the page
And I click the cancel button
Then the preview page should be closed
[When(@"I select '(.*)' tab")]
public void WhenIChooseTheTab(string tab)
{
string elementId = $"{tab.Replace(" ",string.Empty).ToLower()}_TabAId";
navSteps.WaitUntilElementIsDisplayed(elementId);
this.testContext.Browser.FindElement(By.Id(elementId)).Click();
}
[When(@"I click on Report Icon to preview the page")]
public void ThenIClickOnReportIconToPreviewThePage()
{
this.testContext.Browser.FindElement(By.Id("printReport_AId")).Click();
}
[When(@"I click the cancel button")]
public void WhenIClickTheCancelButton()
{
this.testContext.Browser.FindElement(By.ClassName("cancel-button")).Click();
}
it doesn't recognize the cancel button . should i add still , related to web driver?.
because when i click report icon , new instance of chrome created