If else failing after executing custom code

Ranorex Studio, Spy, Recorder, and Driver.
Posts: 6
Joined: Tue Jul 07, 2015 8:27 pm

If else failing after executing custom code

Post by javier.calderon » Thu Jul 30, 2015 2:43 pm

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){
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));
            Report.Log(ReportLevel.Info, "Mouse", "Mouse Left Click item 'NextGearCapital.search_vin' at Center.", repo.NextGearCapital.search_vinInfo, new RecordItemIndex(7));
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)

Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

Re: If else failing after executing custom code

Post by krstcs » Thu Jul 30, 2015 2:56 pm

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.
Shortcuts usually aren't...