C # Failed to return to another class file

I am trying to create an automation system, but I ran into a problem here. Below is a brief description.

main.cs [Test] public void Test_MyPage() { LoginPageObject objLogin = new LoginPageObject(); FunctionTest cc = objLogin.FunctionAbcTest(); FunctionTest objAbcTest = new FunctionTest(); } LoginPageObject.cs // Login Functionality //public void Login (some args){...} // And public FunctionTest FunctionAbcTest() { //some functions to be called .....(1) return new FunctionTest(); } FunctionTest.cs //Test automation functions are called 

Expected Result: Continue further validation to return to the FunctionTest class.

Actual result: After some function that is called in (1), the automation completes, but does not return to FunctionTest.cs

I really need help with this.

I am very grateful for your help.

NOTE:

  • For a more detailed description, you can refer to my project. Click here .

  • Add full path to open excel file

  • Install MS Access Database engine 2010 (either 32 bits or 64 bits depending on your device).

  • Install nunit 2.6.4 and run the project through nunit

  • Visual studio 2013

  • Download expires in 1/3

-2
source share
1 answer

In your main.cs you need to add one line.

 [Test] public void Test_MyPage() { LoginPageObject objLogin = new LoginPageObject(); FunctionTest cc = objLogin.FunctionAbcTest(); FunctionTest objAbcTest = new FunctionTest(); objAbcTest.SpeedTest(); } 

Also change your Xpath to

  [FindsBy(How = How.XPath, Using = "//div[@id='cssmenu']/ul/li[3]/a/span")] public IWebElement UserForm { get; set;} 

This will solve your problem.

And I think that your chosen site should be used as an example to show why your function does not work. Your original site id may be different. And that doesn't seem to be homework.

Please let us know if this works or not.

Best of luck in writing your next code.

0
source

All Articles