Forum Discussion

BMD's avatar
BMD
Contributor
5 years ago
Solved

SetText over Keys for speed

Below is a bit of code that types over 4000 characters into the comment field.  I changed the keys to SetText because it takes too long to type the charterers in to the field.  The SetText I thought would be faster but it does not work at all.  This is using Firefox version 68.5 as the browser and TC is version 14.30.  Any pointers are greatly appreciated.

Thank you, BMD

 

TheString = LOCALBuildThe4000LongString();

var PropNames = ["Name", "idStr", "Visible"];
var PropValues = ["Textarea(\"Comments\")", "Comments", true];
var Comments_TB = Sys.Browser(ProjectSuite.Variables.Browser).Find(PropNames,PropValues,20);

if ( Comments_TB.Exists == true )
{
  Comments_TB.Click();
  Comments_TB.SetText(TheString);
}

 

function LOCALBuildThe4000LongString()
{
  var String1 = "Web testing Automated. ";
  var String = "";
  for (var i=1; i<200; i++)
  {
    String = aqString.Concat(String, String1);
  }
  return String;
}