This project is read-only.

How can I follow a hyperlink into a new page with CUITe?

Feb 11, 2014 at 9:54 PM
Edited Feb 11, 2014 at 10:07 PM
Hello,

I am very new to CUITe and have a basic question. In my code sample, I click on the "lnkNextPage" and I want to actually navigate to that page, however, using the code sample below, the test fails. Am I doing something wrong? I am unsure if I'm using the correct code.

CUITe_BrowserWindow.Launch("http://www.mydomain.com");
WelcomePage pg_WelcomePage = CUITe_BrowserWindow.GetBrowserWindow<WelcomePage>();
pg_WelcomePage.lnkNextPage.Click(); // <--- Now I want to follow the link

NextPage pg_NextPage = CUITe_BrowserWindow.GetBrowserWindow<NextPage>();
pg_NextPage.txtInput.SetText("Hello World");

I love CUITe so far!
Feb 12, 2014 at 2:42 PM
Hi.

What is the error you get?
Feb 12, 2014 at 4:49 PM
Hi,

This is the error:

Image


Thanks for your reply.
Feb 12, 2014 at 5:14 PM
Can you provide the full stack trace please?

Thank you.
Feb 12, 2014 at 7:20 PM
Edited Feb 12, 2014 at 7:20 PM
Hi, here is the stack trace.

Test Name: CodedUITestMethod1
Test FullName: CUITe_C.CodedUITest1.CodedUITestMethod1
Test Source: c:\TFSDEV\CUITe_C\CUITe_C\CodedUITest1.cs : line 55
Test Outcome: Failed
Test Duration: 0:00:07.0533125

Result Message:
Test method CUITe_C.CodedUITest1.CodedUITestMethod1 threw exception:
System.NullReferenceException: Object reference not set to an instance of an object.
Result StackTrace:
at CUITe.ObjectRepositoryManager.GetInstance(Type typePageDefinition, Object[] args) in c:\Working\codeplex\cuite\CUITe\ObjectRepositoryManager.cs:line 33
at CUITe.ObjectRepositoryManager.GetInstance(Type typePageDefinition) in c:\Working\codeplex\cuite\CUITe\ObjectRepositoryManager.cs:line 26
at CUITe.ObjectRepositoryManager.GetInstanceT in c:\Working\codeplex\cuite\CUITe\ObjectRepositoryManager.cs:line 16
at CUITe.Controls.HtmlControls.CUITe_BrowserWindow.GetBrowserWindowT in c:\Working\codeplex\cuite\CUITe\Controls\HtmlControls\CUITe_BrowserWindow.cs:line 68
at CUITe_C.CodedUITest1.CodedUITestMethod1() in c:\TFSDEV\CUITe_C\CUITe_C\CodedUITest1.cs:line 62

Thank you
Feb 13, 2014 at 9:30 AM
What's in CodedUITest1.cs (line 62)?

What do WelcomePage.cd and NextPage.cs look like?
Jul 25, 2014 at 6:59 AM
Hi,
I too face the same problem . All I do is I try to enter the value in a textbox, but it throws


_"Test Name: TCRegistrationPage
Test FullName: CuitEProject.CodedUITest1.TCRegistrationPage
Test Source: c:\Users\rsm\Documents\Visual Studio 2013\Projects\AnAttemptWithCodedUISolution\CuitEProject\CodedUITest1.cs : line 36
Test Outcome: Failed
Test Duration: 0:00:04.9293375

Result Message:
Test method CuitEProject.CodedUITest1.TCRegistrationPage threw exception:
System.NullReferenceException: Object reference not set to an instance of an object.
Result StackTrace:
at CuitEProject.Pages.RegistrationPage.Registration() in c:\Users\rsm\Documents\Visual Studio 2013\Projects\AnAttemptWithCodedUISolution\CuitEProject\Pages\RegistrationPage.cs:line 27
at CuitEProject.CodedUITest1.TCRegistrationPage() in c:\Users\rsm\Documents\Visual Studio 2013\Projects\AnAttemptWithCodedUISolution\CuitEProject\CodedUITest1.cs:line 46

"_

could anyone please help me to resolve this?