icnocop / cuite

Coded UI Test enhanced Framework
Microsoft Public License
52 stars 29 forks source link

Error: The non-generic method 'ApplicationUnderTest.Find()' cannot be used with type arguments #115

Closed JSDreyer closed 7 years ago

JSDreyer commented 7 years ago

Hi,

After following the set up instructions, I'm getting an error straight out of the gate.

  1. Open VS 2015.
  2. Start a new Coded UI Test project
  3. Install CUITe using the Package Manager: Install-Package CUITe.VS2015 -Pre
  4. Open the CUITe recorder
  5. Navigate to my application, the first page of which is a login page.
  6. Click the Record button and click on my page objects: username, password, submit button.
  7. Click the code button, and get the code.
  8. I create a new class, copy the code, and change the namespace to the same as my main project. Here's the code:
    
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using CUITe.SearchConfigurations;
    using Microsoft.VisualStudio.TestTools.UITesting;
    using CUITe.Controls.HtmlControls;
    using Microsoft.VisualStudio.TestTools.UITest.Extension;
    using Keyboard = Microsoft.VisualStudio.TestTools.UITesting.Keyboard;

namespace OSBRRegression.PageObjects { public class WebApplicationLogin : BrowserWindowUnderTest { public WebApplicationLogin() : base("Web Application Login") { }

    public HtmlEdit txtuseridentry { get { return Find<HtmlEdit>(By.SearchProperties("Name=useridentry;Name=useridentry")); } }
    public HtmlPassword txtuserpwdentry { get { return Find<HtmlPassword>(By.SearchProperties("Name=userpwdentry;Name=userpwdentry")); } }
    public HtmlInputButton btnLogin { get { return Find<HtmlInputButton>(By.SearchProperties("Name=submit;Name=submit;Value= Login ")); } }
}

}



VS tells me there are 3 errors:
Line 20: Error   CS0308   The non-generic method 'ApplicationUnderTest.Find()' cannot be used with type arguments
Line 21: Error   CS0308   The non-generic method 'ApplicationUnderTest.Find()' cannot be used with type arguments
Line 22: Error   CS0308   The non-generic method 'ApplicationUnderTest.Find()' cannot be used with type arguments

These errors refer to the last 3 lines in the code containing the Find<> method.  Generics is the entire point of CUITe, so I'm not sure why it's not accepting it.

Thanks
icnocop commented 7 years ago

This is fixed in cuite v2.0.392.

The work-around is to inherit from Page instead of BrowserWindowUnderTest, and remove the constructor.

JSDreyer commented 7 years ago

Thank you sir. I'd actually figured out to inherit from page, but I was still getting the error with the constructor. I wasn't sure I was on the right track though.