public static void InputsOpe(IWebDriver driver, TestPart testPart) { var context = new ContextForAutoTest(); IJavaScriptExecutor jsDriver = driver as IJavaScriptExecutor; testPart.Inputs.ForEach(testInput => { if (testInput.InputAutoPostBack == true) { jsDriver.ExecuteScript($"$p.disableAutPostback = false;"); } else { jsDriver.ExecuteScript($"$p.disableAutPostback = true;"); } if (!testInput.InputWaitTime.IsNullOrEmpty()) { Thread.Sleep(testInput.InputWaitTime.ToInt()); } if (testInput.InputTarget.StartsWith("Check")) { jsDriver.ExecuteScript($"$p.set($p.getControl('{testInput.InputTarget}').prop('checked',{testInput.InputValue}));"); } else { var script = $@" var $element; var target = '{testInput.InputTarget}'; if (target.indexOf('#') === -1) {{ $element = $p.getControl('{testInput.InputTarget}'); }} if ($element === undefined) {{ $element = $(target); }} var value = '{testInput.InputValue}'; if ($element.prop('tagName') === 'SELECT') {{ $element.find('option').each(function(index) {{ if ($(this).text() === value) {{ value = $(this).val(); }} }}); }} $p.set($element, value);"; jsDriver.ExecuteScript(script); } WriteLog( logFileName: Parameters.ExtendedAutoTestSettings.LogFileName, logMessage: Displays.AutoTestEntered( context: context, data: new string[] { testInput.InputTarget, testInput.InputValue }) ); }); }