Unable to compile with VS2010

Jan 26, 2011 at 11:59 AM

Hi, i'm new to White and probably particulary stupid but i can reach to get a compilation succeed when trying White.

So here are the steps:

1. Creating a new console application.

2. In references of the project, I add: White.Core and White.WebBrowser (downloaded vers 0.20 and version 0.19)

3. Here is my full code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using White.WebBrowser;
using White.Core.UIItems;
using White.Core.UIItems.Finders;

namespace WhiteConsoleTest
{
    class Program
    {
        static void Main(string[] args)
        {
            var iei = InternetExplorer.Launch(@"http://localhost/testsilverlight", "test Silverlight");
            var silverDoc = iei.SilverlightDocument;

            var button = silverDoc.Get<Button>(SearchCriteria.ByText("Server Control"));
            if (button != null)
                button.Click();
        }
    }
}
4. and here are the message I get when I try to compile:
Error	3	The type or namespace name 'White' could not be found (are you missing a using directive or an assembly reference?)	C:\Users\pmi\Documents\Visual Studio 2010\Projects\WhiteConsoleTest\WhiteConsoleTest\Program.cs	5	7	WhiteConsoleTest
Error	4	The type or namespace name 'White' could not be found (are you missing a using directive or an assembly reference?)	C:\Users\pmi\Documents\Visual Studio 2010\Projects\WhiteConsoleTest\WhiteConsoleTest\Program.cs	6	7	WhiteConsoleTest
Error	5	The type or namespace name 'White' could not be found (are you missing a using directive or an assembly reference?)	C:\Users\pmi\Documents\Visual Studio 2010\Projects\WhiteConsoleTest\WhiteConsoleTest\Program.cs	7	7	WhiteConsoleTest
Error	6	The name 'InternetExplorer' does not exist in the current context	C:\Users\pmi\Documents\Visual Studio 2010\Projects\WhiteConsoleTest\WhiteConsoleTest\Program.cs	15	23	WhiteConsoleTest
Error	7	The type or namespace name 'Button' could not be found (are you missing a using directive or an assembly reference?)	C:\Users\pmi\Documents\Visual Studio 2010\Projects\WhiteConsoleTest\WhiteConsoleTest\Program.cs	18	40	WhiteConsoleTest
Error	8	The name 'SearchCriteria' does not exist in the current context	C:\Users\pmi\Documents\Visual Studio 2010\Projects\WhiteConsoleTest\WhiteConsoleTest\Program.cs	18	48	WhiteConsoleTest

What the hell am I doing wrong ?

Thx in advance !


 

Jan 26, 2011 at 12:39 PM
Edited Jan 26, 2011 at 12:39 PM

Hi

 

create a Class Library instead of console Application

 

use Nunit to run the test

 

Throdnorin

Jan 26, 2011 at 1:34 PM

Thx a lot, it works great.

 

Can you give me an explanation for why it didn't work as a console app ?

Jan 26, 2011 at 2:14 PM
Pitming wrote:
Can you give me an explanation for why it didn't work as a console app ?

 

Sorry I have no Idea :(

One reason might be that there are other tools needed for test execution like nunit

 

Throndorin

Apr 9, 2011 at 5:31 PM

You probably had the project configured as a .NET Framework 4 Client Profile (which is the default), if that was the case, you just needed to change it to a simple .NET Framework 4.0 console project.