Directly Executing Javascript
Definition:
Since WebDriver can directly execute any arbitrary JavaScript, it can be tempting to bypass DOM manipulation and just run the JavaScript.
Code Example:
public void RemoveTea(string teaType)
{
(driver as IJavaScriptExecutor).ExecuteScript(string.Format("viewModel.tea.types.removeTeaType(\"{0}\");", teaType));
}
References:
Quality attributes
- Code Example
- Cause and Effect
- Frequency
- Refactoring