2

I'm trying to run javascript through Selenium driver. The executeAsyncScript argument gives the exception that input string is not in correct format. The javascript is in the path provided. The javascript function is actually an onclick that does not take any parameters but returns a value that I want to get for further computation.

 Driver.Manage().Timeouts().SetScriptTimeout(TimeSpan.FromSeconds(5));
           var js = Driver as IJavaScriptExecutor;
     var formobject = js.ExecuteAsyncScript(
                           "var callback = arguments[0];"
                         + "var params = arguments;"
                         + "require(['Recruiting/Modules/CandidateProfile'],function(onPrint){"
                         + "onPrint("
                         + ",callback"
                         + ");});"
                     );
2
  • What is the comma before "callback" for? Shouldn't it say onPrint(callback)? I think you might have confused yourself with all the concatenations. Commented Jan 22, 2016 at 20:35
  • That doesn't look like valid JS. Commented Jan 22, 2016 at 20:35

1 Answer 1

5

I think your javascript is syntacticly incorrect. If you would omit the quotes, you would get:

var callback = arguments[0];
var params = arguments;
require(['Recruiting/Modules/CandidateProfile'],function(onPrint){
onPrint(
,callback
);});

See the , after the onPrint and before the callback.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.