0

I am new to specflow. Currently I am having a problem how to get a response text from browser button click. So below is my code

Scenario Outline:Download Questions and it should contain csv file extension
Given I am logged in as a  user 
When I select value "Ordinary" of select object with id "QuestionType"
And I select value "Answered" of select object with id "DisplayStatus"
And I click on the Download button

From browser when I click download button it downloads a csv file and I want to write same scenario how can I check if the response text is csv ?

Please let me know if you need any more information.

Ok I am using selenium driver to run the features.

Below is some code

 [Given(@"I am logged in as (?:a|an) (.* user)")]
    public void GivenIAmLoggedInAs(LoginTypeName loginTypeName)
    {
        string pageUrl = PageFactory.GetPageUrlFor(PageName.Home);
        CurrentDriver.GoToWithBase(pageUrl, _baseWebsite);
        CurrentDriver.FindElementById(LoginFactory.GetLoginElementFor(loginTypeName)).Click();
        WaitUntilClickableById("footer");
    }
62071072SP
  • 1,963
  • 2
  • 19
  • 38
  • 1
    Actually *this is not a question about SpecFlow*. Your problem is with whatever web stack testing library you are running. Please change your question to include details of the waitin, selenium etc library you are using.. – AlSki Aug 05 '14 at 08:37
  • your scenario is incomplete. you haven't told us what your `Then` step is. it would also be useful to see the code for the other steps in your scenario. it's impossible to answer your question at the moment – Sam Holder Aug 05 '14 at 12:10
  • @SamHolder Then the response file extension should contain '.csv' – 62071072SP Aug 05 '14 at 14:33

1 Answers1

0

Here is some reference: Selenium WebDriver File Download Testing

You should set your webdriver with browser setting to automatically download without asking for a location. When your tests have downloaded file to your testing environment, you can use System.IO to assert the filename.

In91
  • 141
  • 1
  • 2