0

I am using Watin system in my program.

I get the following error:

ArgumentNullException at Watin.Core.Comparer
StringComparer(string comparisonValue, bool ignoreCase)
Error : Value Cannot be Null(comparisonValue)

But I have no idea that who and when stringcomparer is called, also I don't know how to debug it.

Here is some of my code.

using (IE browser = new IE(url))  
            {  
                Trace.TraceInformation("success to create IE instance.");

                int waitSecond = TimeSpan.FromSeconds(30).Seconds;
                browser.WaitForComplete(waitSecond);
                .........
                .........
            }
       )

Add some ErrorTrace

at WatiN.Core.Comparers.StringComparer..ctor(String comparisonValue, Boolean ignoreCase)
at WitiN.core.DialogHandlers.DialogWatcher.HasDialogSameProcessNameAsBrowserWindow(Window window)
at WatiN.Core.DialogHandlers.DialogWatcher.HandleWindow(Window window)
at WatiN.Core.DialogHandlers.DialogWatcher.Start()
at System.Threading.ThreadHelper.ThreadStart_Context(ojbect state)
at System.Threading.ExecutionContext.Runinternal(exceutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutinoContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutinoContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
Phillip
  • 1
  • 2

1 Answers1

0

This code works as expected (no exceptions thrown):

        using (IE browser = new IE("http://www.google.com"))
        {
            //Trace.TraceInformation("success to create IE instance.");

            int waitSecond = TimeSpan.FromSeconds(30).Seconds;
            browser.WaitForComplete(waitSecond);
        }

Make sure you are using the latest sources for WatiN and you don't have any other code executing at that time (the exception you are getting if for a DialogWatcher, nothing to do with the code you posted).

Not sure why you've used the .WaitForComplete method like that but that method is called by default internally for each method you run that interacts with a web page. If you want to specify a generic wait time for loading web pages you should use settings for the WatiN object like this:

        Settings.WaitForCompleteTimeOut = 30;
        using (IE browser = new IE("http://www.google.com"))
        {
            //Trace.TraceInformation("success to create IE instance.");
            browser.WaitForComplete();
        }
ProgrammerV5
  • 1,915
  • 2
  • 12
  • 22