CompiledScript.SetCookieForUrl Method

Definition

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

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

Parameters

 url  string

 name  string

 value  string

Use “*” as a wildcard at the beginning or end of the URL string and “?” as a single-letter wildcard.

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 
SetCookieForUrl ("*dotcom-monitor*", "_dm_tracking_cookie", "67f82a23-c98d-41fb-bc5a-b17f0ba34567");
tab0.GoTo ("http://dotcom-monitor.com");
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/");