Page 1 of 1

If else failing after executing custom code

Posted: Thu Jul 30, 2015 2:43 pm
by javier.calderon
For my code I put an if statement to capture a dynamic field that might be enable depending on results. Currently the conditional is working if it is met but after it enter the texts it keeps searching for an item and then fails. Do I need to add something to make it stop. My code is below

Code: Select all

public void make_autopop()
        {
        	if(repo.NextGearCapital.floor_make.Enabled == true){
        		repo.NextGearCapital.floor_make.PressKeys("BMW");
        		}
Code from ranorex

Code: Select all

            Report.Log(ReportLevel.Info, "Keyboard", "Key sequence 'WAUHD0441HN150960' with focus on 'NextGearCapital.InputVin'.", repo.NextGearCapital.InputVinInfo, new RecordItemIndex(6));
            repo.NextGearCapital.InputVin.PressKeys("WAUHD0441HN150960");
            Delay.Milliseconds(0);
            
            Report.Log(ReportLevel.Info, "Mouse", "Mouse Left Click item 'NextGearCapital.search_vin' at Center.", repo.NextGearCapital.search_vinInfo, new RecordItemIndex(7));
            repo.NextGearCapital.search_vin.Click();
            Delay.Milliseconds(200);
            
            make_autopop();
            Delay.Milliseconds(0);
This is my error message

Failed to find item 'PaymentsRepository.NextGearCapital.floor_model'.
No element found for path '/dom[@domain='test.nextgearcapital.com']//input[#'outputModel']' within 1m.
Show/Hide Stacktrace
at Ranorex.Core.Repository.RepoItemInfo.Find[T](Boolean findSingle, Boolean throwException, Duration effectiveTimeoutOverride) at Ranorex.Core.Repository.RepoItemInfo.CreateAdapter[T](Boolean throwException, Duration waitTimeout) at Ranorex.Core.Repository.RepoItemInfo.CreateAdapter[T](Boolean throwException) at Payments.PaymentsRepositoryFolders.NextGearCapitalAppFolder.get_floor_model() in c:\Users\javier.calderon\Documents\Ranorex\RanorexStudio Projects\Payments\Payments\PaymentsRepository.cs:line 1156 at Payments.Recording_Templates.Floor_vehicle.model_autopop() in c:\Users\javier.calderon\Documents\Ranorex\RanorexStudio Projects\Payments\Payments\Recording Templates\Floor_vehicle.UserCode.cs:line 51 at Payments.Recording_Templates.Floor_vehicle.Ranorex.Core.Testing.ITestModule.Run() in c:\Users\javier.calderon\Documents\Ranorex\RanorexStudio Projects\Payments\Payments\Recording Templates\Floor_vehicle.cs:line 150 at Ranorex.Core.Testing.TestSuiteModule.RunInternal(DataContext parentDataContext)

Re: If else failing after executing custom code

Posted: Thu Jul 30, 2015 2:56 pm
by krstcs
The error message means that the given path does not correctly correspond to an element on the page. You need to change the path to match the element you are trying to find.