ZennoLab Assemblies Documentation
ChangeResponse Method
Example 
ZennoLab.CommandCenter Namespace > Instance Class : ChangeResponse Method

Type: System.String

The regex string to find the response url.

Type: System.Collections.IEnumerable

Collection of regexs to find data in the response body.

Type: System.Collections.IEnumerable

Collection of strings to replace the relevant data.

Type: System.Boolean

The true if use this replacement all time; otherwise and default, false.

Replaces data of browser response.
Syntax

Parameters

regexUrl

Type: System.String

The regex string to find the response url.

regexesForReplace

Type: System.Collections.IEnumerable

Collection of regexs to find data in the response body.

datasForReplace

Type: System.Collections.IEnumerable

Collection of strings to replace the relevant data.

allTime

Type: System.Boolean

The true if use this replacement all time; otherwise and default, false.

Remarks

To find the response use regex "regexUrl". To replace data in the response body use collections "regexesForReplace" and "datasForReplace", the first collection contains regular expressions that will replace the original data with the corresponding elements from the second collection. The "regexesForReplace" and "datasForReplace" collections should has a same size, otherwise the method doesn't perform and set ErrorDetected to True.

Example
The following code example demonstrates uses of the ChangeRequest method.
instance.ChangeResponse("http://lessons.zennolab.com/en/index", 
    new List<string> 
    { 
	    "(?<=<input type=\"checkbox\" class=\"inputs\"><h2>&ensp;).*(?=</h2>)",
	    "(?<=<textarea rows=\"5\" cols=\"45\" name=\"text\">).*(?=</textarea>)",
	    "<h2>Any text:</h2>"
    }, 
    new List<string> 
    { 
	    "no OS",
	    "NEW TEXT TO TEXTAREA",
	    "<h2>NEW HEADER TO TEXTAREA:</h2>"
    });
instance.ChangeRequest(@"(?<=https://mc\.yandex\.ru/webvisor/).*", new List<string> { @"(?<=wv-data=).*" }, new List<string> { "NODATA" }, true);
            
Tab tab = instance.ActiveTab;
if ((tab.IsVoid) || (tab.IsNull)) return -1;
if (tab.IsBusy) tab.WaitDownloading();
tab.Navigate("lessons.zennolab.com", "");
if (tab.IsBusy) tab.WaitDownloading();
Requirements

Target Platforms: Desktop: Windows XP SP3 and older. Server: Windows Server 2003 and older.

See Also

Reference

Instance Class
Instance Members
ChangeRequest Method