user806982
user806982

Reputation: 135

Selenium IDE - verify content of Cookie

Does anyone know how I would go about verifying that a cookie value contains a text substring in Selenium IDE?

e.g. if I had a cookie called 'MyCookie' which had as its contents 'This is my value', and I wanted to assert that the cookie contained the substring 'value', is this possible using the IDE?

Update

Solution is as follows

storeCookieByName | MyCookie | variable1

storeEval | storedVars['variable1'].indexOf('value') > 0 ? true: false|result;

verifyExpression | $(result) | true

Upvotes: 1

Views: 3633

Answers (2)

Ankit jain
Ankit jain

Reputation: 4328

In selenium ide storeCookieByName(name, variableName) function return the value of cookies, in this function you provide only cookies name in target column and write any variable in value column

       Command       |    Target   |  value
   storeCookieByName | mf_user     | test
      echo           | ${test}

name - the name of the cookie.

storeCookieByName function Returns: the value of the cookie

Upvotes: 4

Farlan
Farlan

Reputation: 1900

In the IDE use the storeCookieByName function providing the cookie name and the variable name you want the value to store the cookie into.

Upvotes: 1

Related Questions