-1

I am using C# and the Selenium Webdriver in Visual Studio 2017 to automate some tests. I am currently stuck with a test that fails to find an element after canceling an alert.

When I step through the code, I get an error indicating that Reflect.js could not be found:

Locating source for 'C:\src\nunit\nunit\src\NUnitFramework\framework\Internal\Reflect.cs'. Checksum: SHA1 {db ae 17 40 7a 46 56 f6 79 ee 5a 25 c7 7 94 f1 97 c1 a5 de} The file 'C:\src\nunit\nunit\src\NUnitFramework\framework\Internal\Reflect.cs' does not exist. Looking in script documents for 'C:\src\nunit\nunit\src\NUnitFramework\framework\Internal\Reflect.cs'... Looking in the Edit-and-Continue directory 'C:\GitLab\Automated-Testing\Selenium\SeleniumFramework\enc_temp_folder\'... The file with the matching checksum was not found in the Edit-and-Continue directory. Looking in the projects for 'C:\src\nunit\nunit\src\NUnitFramework\framework\Internal\Reflect.cs'. The file was not found in a project. Searching for documents embedded in the symbol file. An embedded document was not found. The debug source files settings for the active solution indicate that the debugger will not ask the user to find the file: C:\src\nunit\nunit\src\NUnitFramework\framework\Internal\Reflect.cs. The debugger could not locate the source file 'C:\src\nunit\nunit\src\NUnitFramework\framework\Internal\Reflect.cs'.

My suspicion is that something about canceling the alert caused NUnit to lose track of its Reflect.js file. Here is the CancelAlert code:

    public static void CancelAlert()
    {
        Driver.SwitchTo().Alert().Dismiss();
    }

Anyone have any ideas as to how I can get past this this error?

haldo
  • 14,512
  • 5
  • 46
  • 52
Kelly
  • 1
  • 1
  • Removed the alert from the test and the element still could not be found, even though I had just found it and set its value. So this has nothing to do with Reflect.cs, nor with the alert dismissal. I would downvote my question also but it will not let me. – Kelly Mar 21 '19 at 17:35

1 Answers1

2

First of all, if you read the message, it's Reflect.cs not .js.

Secondly, it's not NUnit that's unable to find it but the VS debugger.

The NUnit framework is written in C#. One of the files that makes it up is that one: Reflect.cs. You have apparently done something to ask or you have some settings that ask the debugger to step into NUnit's own code. If that's not intentional, just don't try to debug outside your own Debug code.

If you are really intent on debugging the NUnit code, then you need to have a copy of the source code installed somewhere on your machine.

None of this has anything to do with the actual exception that occured but the debug messages are probably obscuring your actual problem.

Charlie
  • 12,928
  • 1
  • 27
  • 31
  • Thanks, Charlie. I have been struggling to get Visual Studio to debug my tests as I run them with NUnit. It either ignores my breaks (F9) or it debugs everything. – Kelly Mar 21 '19 at 16:50