RepositoryItemInfo doesn't have all methods

Class library usage, coding and language questions.
jattMones
Posts: 4
Joined: Tue Jan 21, 2020 8:10 pm

RepositoryItemInfo doesn't have all methods

Post by jattMones » Wed Apr 22, 2020 3:19 pm

Hello I'm having some issues accessing the `Exists()` and `WaitForExists()` methods in my user_module code. Below is my code and the error I receive.
Code:

Code: Select all

/*
 * Created by Ranorex
 * User: mjones10
 * Date: 4/20/2020
 * Time: 4:01 PM
 * 
 * To change this template use Tools > Options > Coding > Edit standard headers.
 */
using System;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;
using System.Drawing;
using System.Threading;
using WinForms = System.Windows.Forms;

using Ranorex;
using Ranorex.Core;
using Ranorex.Core.Testing;

namespace MyTest15
{
    /// <summary>
    /// Description of UserCodeModule1.
    /// </summary>
    [TestModule("35A74F2E-20EF-4C02-B554-FFC6CF0F0560", ModuleType.UserCode, 1)]
    public class Launch_ca : ITestModule
    {
        /// <summary>
        /// Constructs a new instance.
        /// </summary>
        public Launch_ca()
        {
            // Do not delete - a parameterless constructor is required!
        }

        /// <summary>
        /// Performs the playback of actions in this module.
        /// </summary>
        /// <remarks>You should not call this method directly, instead pass the module
        /// instance to the <see cref="TestModuleRunner.Run(ITestModule)"/> method
        /// that will in turn invoke this method.</remarks>
        void ITestModule.Run()
        {
            Mouse.DefaultMoveTime = 300;
            Keyboard.DefaultKeyPressTime = 100;
            Delay.SpeedFactor = 1.0;
            
            MyTest15.MyTest15Repository my_repo = new MyTest15Repository();
            var service_location = my_repo.service_location;
            service_location.WaitForExists(120);
            var drop_down = my_repo.service_location.drop_down;
            drop_down.PressKeys("Columbus 0044{Return}");
            var columbus_text = my_repo.service_location.drop_down.SelectedItemText;
            var ok_btn = my_repo.service_location.ok_btn;
            ok_btn.Click();
        }
    }
}

Error:
'MyTest15.MyTest15RepositoryFolders.Service_locationAppFolder' does not contain a definition for 'WaitForExists' and no extension method 'WaitForExists' accepting a first argument of type 'MyTest15.MyTest15RepositoryFolders.Service_locationAppFolder' could be found (are you missing a using directive or an assembly reference?) (CS1061) - C:\Users\mjones10\Documents\Ranorex\RanorexStudio Projects\MyTest15\MyTest15\launch_ca.cs:51,30


When I remove the WaitForExists line, the program works as expected.

I'm writing my code_modules in the ranorex studio editor, but the methods mentioned above don't appear in the editors auto-complete pop-up after I type `RepositoryItemInfo.`, or when i just try to type either method alone. Only `Equals` and `ReferenceEquals` appear as methods after the `RepositoryItemInfo.` library. Additionally, I found an Exists() method under the validate library @ Validate.Exists() (could i perhaps use this to mimic a WaitUntilExists method?). I've seen other posts where it was suggested that people experiencing issues like this remove the ranorex references and reopen the project in Ranorex Studio(because the project was outdated), but this is a project i started within the last couple of days. I'm running Ranorex 9.0.0 . Suggestions & thoughts are appreciated

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 6036
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: RepositoryItemInfo doesn't have all methods

Post by odklizec » Wed Apr 22, 2020 7:54 pm

Hi,

At first, please start with updating Ranorex to most recent 9.3.1 or at very least 9.2.1 . Version 9.0.0 is somewhat old and buggy and not really recommended since there are much better versions in the wild. Seriously, even 9.0.1 is better choice, but you should really consider most recent 9.3.1 ;)

As for your problem, in case the pointed repo element is a repo folder, you must add SelfInfo right after the repo element, like this...
service_location.SelfInfo.WaitForExists();
Hope this helps?
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

jattMones
Posts: 4
Joined: Tue Jan 21, 2020 8:10 pm

Re: RepositoryItemInfo doesn't have all methods

Post by jattMones » Thu Apr 23, 2020 8:49 pm

Thank you!