This question is locked. New answers and comments are not allowed.
Hi Telerik team,
i would like to create a test that depends on 'Remove_Official_Target' link button as shown in my attachment(capture commitment1) .
If that link button exists, i'll do a, else, i'll do b.
Currently, i used an if...else statement in my coded step to perform that but it gives me an null exception error when the "'Remove_Official_Target" link doesn't exists.
The code behind if _ else is below.
i would like to create a test that depends on 'Remove_Official_Target' link button as shown in my attachment(capture commitment1) .
If that link button exists, i'll do a, else, i'll do b.
Currently, i used an if...else statement in my coded step to perform that but it gives me an null exception error when the "'Remove_Official_Target" link doesn't exists.
The code behind if _ else is below.
.
[CodedStep(@"Click 'RemoveLink'")] public void CaptureCommitmentTest_CodedStep() { if (Pages.FactoryPlanningSystem_2.RemoveLink.IsVisible()) { // Click 'RemoveLink' Pages.FactoryPlanningSystem_2.RemoveLink.Click(false); // Wait for 'TextContent' 'Contains' 'Official Target UnSet' on 'ContentPlaceHolder1LblTargetNonOfficialMessageSpan' HtmlSpan ContentPlaceHolder1LblTargetNonOfficialMessageSpan = Pages.FactoryPlanningSystem_2.ContentPlaceHolder1LblTargetNonOfficialMessageSpan; ContentPlaceHolder1LblTargetNonOfficialMessageSpan.Wait.ForExists(5000); Wait.For<HtmlSpan>(c => c.AssertContent().TextContent(ArtOfTest.Common.StringCompareType.Contains, "Official Target UnSet"), ContentPlaceHolder1LblTargetNonOfficialMessageSpan, 10000); } // Add your test methods here... } }
I try to if (Pages.FactoryPlanningSystem_2.RemoveLink.IsVisible()) with if (Pages.FactoryPlanningSystem_2.RemoveLink != null) .
It gives the same error.
Any advice on this?