This is a migrated thread and some comments may be shown as answers.
How to add cookie to view a different web page
1 Answer 16 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
Kevin asked on 01 Apr 2012, 03:40 AM
Hi team,
i met an issue about cookie today. In my web application, there is a debug page("") to add a cookie with name "dealerPooling" and value "true", if i add this cookie, then a proper page will display.
My version of  telerik test studio is 2011.2.1413.0

scenario 1:
     step1: turn to ""
     step2: click on FIESTA image
     step3: input a zipcode(48033) to zipcode input textbox and click "SEARCH DEALER INVENTORY" button
     step4: A search dealer inventory page for this scenario1 will display

scenario 2:
     turn to a debug page "" and add a cookie with name "dealerPooling" and value "true"
     repeat steps in scenario2, and we can see a different search dealer inventory page for this scenario2.

What i want to know is how to add cookie with code steps?
I have tried several ways to do that, but failed, only scenario1 page displayed when i execute scenario2 step, here is some code to be invoked before clicking "SEARCH DEALER INVENTORY"

Public Sub SetCookie()
            Dim newCookie As New System.Net.Cookie()
            newCookie.Name = "dealerPooling"
            newCookie.Value = "true"
            newCookie.Domain = ""
            newCookie.Expires = DateTime.MaxValue

End Sub

Public Sub SetCookieWithDebugPage()
            Dim nameBox, valueBox As HtmlInputText
            Dim submitButton As HtmlInputSubmit
            nameBox = Find.ByAttributes(of HtmlInputText)("name=newName")
            valueBox = Find.ByAttributes(of HtmlInputText)("name=newValue")
            nameBox.Text = "dealerPooling"
            valueBox.Text = "true"
            submitButton = Find.ByAttributes(of HtmlInputSubmit)("name=addCookie")
End Sub

1 Answer, 1 is accepted

Sort by
Telerik team
answered on 03 Apr 2012, 10:24 PM
Hello Kevin,

This is a duplicate of your other forum post. Let's continue the discussion there.

All the best,
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
Asked by
Top achievements
Rank 1
Answers by
Telerik team
Share this question