InvokeScript method not working in Edge

7 posts, 0 answers
  1. Jeff
    Jeff avatar
    23 posts
    Member since:
    Sep 2013

    Posted 25 May 2017 Link to this post

    I get an error message when trying to use the InvokeScript method in Edge.  It works in all other browsers but Edge.  Am I missing a browser setting somewhere? I can open the development tools in Edge and run the same javascript in the console that I am passing to the InvokeScript method and it works fine.
  2. Nikolai
    Admin
    Nikolai avatar
    106 posts

    Posted 26 May 2017 Link to this post

    Hi Jeff,

    I've tried some simple code like this: 

    this.Log.WriteLine(this.ActiveBrowser.Actions.InvokeScript("location.href"));

    and worked fine. Can you please share your code so we can test/debug it locally? 

    Regards,
    Nikolai
    Progress Telerik
     
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
     
  3. Jeff
    Jeff avatar
    23 posts
    Member since:
    Sep 2013

    Posted 26 May 2017 in reply to Nikolai Link to this post

    Here is some of the code that is failing when using the InvokeScript method.  cw is my ActiveBrowser.  This code works on all browsers except Edge.

            public void Actual_Finish(string date)
            {
                cw.Actions.InvokeScript("$('#ctl00_Main_calActualFinishDate').val(new Date('" + date + "'))");
                
            }

     

     

     

  4. Jeff
    Jeff avatar
    23 posts
    Member since:
    Sep 2013

    Posted 26 May 2017 in reply to Jeff Link to this post

    This is the error I am seeing. 

     

    "An exception of type 'ArtOfTest.WebAii.Exceptions.ExecuteCommandException' occurred in ArtOfTest.WebAii.dll but was not handled in user code"

  5. Nikolai
    Admin
    Nikolai avatar
    106 posts

    Posted 29 May 2017 Link to this post

    Hello Jeff,

    Since you are relying on jQuery you will need more time so that the Edge engine can properly load all dependencies, I've tried this against the Kendo jQuery demos and everything worked fine:

    this.ActiveBrowser.NavigateTo("http://demos.telerik.com/kendo-ui/dateinput/index");           
    System.Threading.Thread.Sleep(5000);
    this.ActiveBrowser.Actions.InvokeScript("$(\"#dateinput\").val(\"5.5.2017\");");           
    System.Threading.Thread.Sleep(5000);


    Regards,
    Nikolai
    Progress Telerik
     
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
     
  6. Jeff
    Jeff avatar
    23 posts
    Member since:
    Sep 2013

    Posted 06 Jun 2017 in reply to Nikolai Link to this post

    It still does not work.
  7. Nikolay Petrov
    Admin
    Nikolay Petrov avatar
    308 posts

    Posted 09 Jun 2017 Link to this post

    Hi Jeff,

    It seems then that the problem is an application specific one. Could you provide a sample app that reproduce the problem to investigate it, please?

    Kind Regards,
    Nikolay Petrov
    Progress Telerik
     
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
     
Back to Top