CompiledScript.SetCookieForUrl Method


Adds browser cookies with the specified “name-value” pair to all requests to the provided domain or hostname.

public void SetCookieForUrl(string url, string name, string value)


 url  string

 name  string

 value  string

Use “*” as a wildcard for a subdomain name. The URL string might contain a full domain or subdomain name.

To filter out a specific cookie in requests to a specific URL, provide the following cookie value in the Value field of the Set Cookie method settings:


For example, the following code will filter out the cookie with the cookie_name name in all requests to

SetCookieForUrl ("", "cookie_name", null);

Make sure to include http://  into the URL address.


tab0.GoTo ("");
SetCookieForUrl ("", "cookie_name", "cookie_value");


tab0.GoTo ("");
SetCookieForUrl ("", "cookie_name", "cookie_value");


DMBrowser tab1 = null;
Step (1, "Dotcom-Monitor: Website Monitoring and Performance Testing -");
tab0 = Tabs.NewTab ();
//Add the specified cookies to all requests to DM domain 
tab0.GoTo ("");
SetCookieForUrl ("http://*", "_dm_tracking_cookie", "67f82a23-c98d-41fb-bc5a-b17f0ba34567");
tab0.Link ("(//A[normalize-space(text())=\"Pricing\"])[1]", "(//LI[@ID=\"mega-menu-item-2198\"])[1]//A[normalize-space()=\"Pricing\"]", "(//LI[@ID=\"mega-menu-item-2198\"])[1]//A[normalize-space(text())=\"Pricing\"]").Click ();
Step (2, "Pricing - Dotcom-Monitor -");

tab0.Navigating ("");