Generic Browser Actions - Browser Extension
Browser Actions
Browser Actions contains set of actions that you can give a simulation for user action on the browser. It supports all Chrome-based browsers.
HtmlInput, Find Action
Following action will trigger a process to find h2 element on the page and compare exact validation of the value with “Welcome Back, {{UserName}}”. In this example, {{UserName}} will be replaced current user’s Username.
browserEvent.AddAction(MSMRBrowserActionTypes.HtmlInput, new {
Action = "FIND", // What do you want?
Selector = "h2", // Which element do you need to find?
Multiple = true, // Could you find it multiply to validate?
Html = false, // Do you want to use innerText or innerHTML to validate?
Value = "Welcome Back, {{UserName}}", // What do you want to compare?
Operator = "equals", // equals, notEquals, contains, notContains, regex, notRegex, startsWith, endsWith
Wait = true, // Wait until you find it, or do exact content compare at the current state of body
Timeout = 10 // How many seconds do you want to wait for finding it?
});
Also, you can find the following explanations of the action.
Primary action on this one is HtmlInput. It means it will use the HTML Element to do an action.
Secondary actions is FIND and selector is h2. And that means find that element with Selector = h2 and do Multiple = true search (that means if that page has more than one h2 elements, search them all.
Html is a property that help us to compare that value with HTML (true) or it is context value (false).
Operator is something that you define the comparison action. Such as equals mean exact comparison, notEquals mean different than this value an so on. (Allowed values are equals, notEquals, contains, notContains, startsWith, endsWith, regex, notRegex.
Wait means, wait to find the element in the page for 10 seconds which we define it in the Timeout value.
For more examples;