internet explorer - Using Selenium IE driver in C# to quickly post a large amount of text (10,000 lines) -
so i'm writing script automate simple, monotonous task using selenium internet explorer driver in c#.
everything works great, tad bit slow @ 1 point in script , i'm wondering if there quicker way available want.
the point in question when have fill out textbox lot of information. textbox filled 10,000 lines each line never exceeds 20 characters.
however, following approach slow...
// process sample file using linq query var items = file.readalllines(samplefile).select(a => a.split(',').first()); // process items want add textbox var stringbuilder = new stringbuilder(); foreach (var item in items) { stringbuilder.append(item + environment.newline); } inputtextbox.sendkeys(stringbuilder.tostring());
is there set value of textbox want? or bottleneck?
thank time , patience!
so suggested richard - ended using ijavascriptexecutor
.
the exact solution replace call sendkeys
in following line of code:
inputtextbox.sendkeys(stringbuilder.tostring());
with line of code:
((ijavascriptexecutor)iedriver).executescript("arguments[0].value = arguments[1]", inputtextbox, stringbuilder.tostring());
casting internetexplorerdriver
object ijavascriptexecutor
interface in order reach explicitly implemented interface member executescript
, making call member arguments above did trick.
Comments
Post a Comment