Forum Discussion

sridhar249's avatar
sridhar249
Occasional Contributor
6 years ago

Testcomplete: How to set a cookie value in smartbear browser for an android app.

I am testing a android mobile app using Test complete. I am using the smartbear browser on the app for testing the website. 

 

I am looking for a way to set a particular cookie value before i  proceed with my test. Is there a way to set a particular cookie value? Please help.

 

Thanks,

Sridhar.

  • AlexKaras's avatar
    AlexKaras
    6 years ago

    Hi Sridhar,

     

    Answering your exact question: Cookies are internal functionality of web browsers that is not accessible to regular end-users.

    As you said, even in full-fledged Chrome some third-party proxy/extension/application is required to get access to cookies content during runtime. Obviously, I would not expect that something similar exists for the simplified basic SmartBear browser.

     

    As a side note: Your scenario more looks like unit/integration/API test rather than functional one. I.e. it looks like to me that you are sending web request with the cookie set to some value and expect to receive certain data in response depending on the cookie's value. This is fine for the API test (and can be easily implemented using, say SoapUI tool). But this is not how real human end-user works. (And primary area of TestComplete is to emulate human end-user actions.) In real world, real user, most probably, will have some login procedure that will set his/her role/permissions and set cookie value based on that. This cookie value will be used than by browser for the data requests.

     

    Anyway, if you really need to access/modify cookie values, Fiddler may be an option for you: https://www.telerik.com/blogs/how-to-capture-android-traffic-with-fiddler

     

  • AlexKaras's avatar
    AlexKaras
    Champion Level 3

    Hi Sridhar,

     

    I seem do not remember the case when some cookie had to be set during test of web application. Also I am not sure this is possible for the browser. I think this can be done with the help of some proxy (e.g. Fiddler) that will analyse the traffic through it and modify/set required cookie.

    Can you provide us with the use case when this is required?

     

    • sridhar249's avatar
      sridhar249
      Occasional Contributor

      Hi Alex,

       

      While testing the desktop version of our app, we still need to set a particular cookie value so as to see the expected prices on the webpage. We do this by installing EditThisCookie chrome app and we set the given cookie to the value we want and then start the Testcomplete Testcase on chrome browser. This works very well for us.

       

      Now, we are looking to test the same thing on android using smartbear browser and looking for a way to set the cookie.

       

      Thanks,

      Sridhar.

      • AlexKaras's avatar
        AlexKaras
        Champion Level 3

        Hi Sridhar,

         

        Answering your exact question: Cookies are internal functionality of web browsers that is not accessible to regular end-users.

        As you said, even in full-fledged Chrome some third-party proxy/extension/application is required to get access to cookies content during runtime. Obviously, I would not expect that something similar exists for the simplified basic SmartBear browser.

         

        As a side note: Your scenario more looks like unit/integration/API test rather than functional one. I.e. it looks like to me that you are sending web request with the cookie set to some value and expect to receive certain data in response depending on the cookie's value. This is fine for the API test (and can be easily implemented using, say SoapUI tool). But this is not how real human end-user works. (And primary area of TestComplete is to emulate human end-user actions.) In real world, real user, most probably, will have some login procedure that will set his/her role/permissions and set cookie value based on that. This cookie value will be used than by browser for the data requests.

         

        Anyway, if you really need to access/modify cookie values, Fiddler may be an option for you: https://www.telerik.com/blogs/how-to-capture-android-traffic-with-fiddler