Attempting to insert the large amount of data into the "Textarea1" control, I have tried two different methods. The first method successfully inserts the data but occasionally throws a timeout error, while the second method results in a JavaScript error. Any assistance would be appreciated.
public StringBuilder PasteDataIn_Tarea1
{
set
{
//Method1
Textarea1.Clear();
Textarea1.SendKeys(value.ToString());
//Method2
IWebDriver driver;
IJavaScriptExecutor js = (IJavaScriptExecutor)driver;
StringBuilder javascript = new StringBuilder();
javascript.Append(string.Format("$('#Textarea1').text('{0}')", value));//value has my data which is quiet big, "Textarea1" is where I need to paste my data
js.ExecuteScript(javascript.ToString()); // Js exector which should paste my data
}
}
Method2
encounters the following exception:
An exception of type 'System.InvalidOperationException' occurred in WebDriver.dll but was not handled in user code
Additional information: JavaScript error (UnexpectedJavaScriptError)
I am inclined towards using Method2
as it appears to be a faster way to insert the data into the textarea, despite the encountered error with this method.