CompiledScript.SetCookieForUrl Method
Definition
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)
Parameters
url string name string value stringUse “*” 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:
{{null}}
For example, the following code will filter out the cookie with the cookie_name name in all requests to https://www.site.org:
SetCookieForUrl ("https://www.site.org", "cookie_name", null);
Examples
DMBrowser tab1 = null; Step (1, "Dotcom-Monitor: Website Monitoring and Performance Testing - https://www.dotcom-monitor.com/"); tab0 = Tabs.NewTab (); //Add the specified cookies to all requests to DM domain tab0.GoTo ("http://dotcom-monitor.com"); SetCookieForUrl ("http://*.dotcom-monitor.com", "_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 - https://www.dotcom-monitor.com/pricing/"); tab0.Navigating ("https://www.dotcom-monitor.com/pricing/");