Hello,
I have a number of list items that are not present on the screen at the time I want to access them. I created a simple method to pass in the object and do a while not visible click on the scroll down arrow button. Once the object is visible access it. Problem is, when passing the object name via the method, Ranorex looks for the object right then and fails. I can't even get to the point of saying "I know it's not there yet, so do this until it is".
My code is:
FindScrubber(repo.Gen2Interface.ScrubbingTab.ScrubTestList.TrimLeft);
public static void FindScrubber(Text scrubTest)
{
while (scrubTest.Visible == false)
{
repo.Gen2Interface.ScrubbingTab.ScrubTestList.ButtonScrollDown.Click();
}
scrubTest.Click();
}
How do I get around this problem? I have over 40 objects that fit this so I need to create a method that pulls them all into view.
Thanks,
Jason
Passing objects to methods that aren't visible
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: Passing objects to methods that aren't visible
You are right, to get an adapter instance (e.g. "Text scrubTest"), you must first find it, i.e. the UI element must already be there for Ranorex to create the corresponding object. However, you can use the corresponding RanoreXPath or the RepoItemInfo object instead and check whether the element already exists by evaluating the RepoItemInfo.Exist method:
Alex
Ranorex Support Team
FindScrubber(repo.Gen2Interface.ScrubbingTab.ScrubTestList.TrimLeftInfo); public static void FindScrubber(RepoItemInfo scrubTestInfo) { Text scrubTest; while (!scrubTestInfo.Exists(out scrubTest) || scrubTest.Visible == false) { repo.Gen2Interface.ScrubbingTab.ScrubTestList.ButtonScrollDown.Click(); } scrubTest.Click(); }Regards,
Alex
Ranorex Support Team
Re: Passing objects to methods that aren't visible
Hi Alex,
I had tried passing in the info but didn't have the RepoItemInfo object, descriptor or whatever. (what do you call these things like RepoItemInfo that you are setting the variables to?).
This does, however, fail with the error:
The type or namespace name 'RepoItemInfo' could not be found (are you missing a using directive or an assembly reference?) (CS0246) - C:\QA\RanorexAutomation\Gen2\SourceExtract\SourceExtract\Scrubber.cs:72,35
Do I need to be including something more than Ranorex and Ranorex.Core in my using statements?
Thanks,
Jason
I had tried passing in the info but didn't have the RepoItemInfo object, descriptor or whatever. (what do you call these things like RepoItemInfo that you are setting the variables to?).
This does, however, fail with the error:
The type or namespace name 'RepoItemInfo' could not be found (are you missing a using directive or an assembly reference?) (CS0246) - C:\QA\RanorexAutomation\Gen2\SourceExtract\SourceExtract\Scrubber.cs:72,35
Do I need to be including something more than Ranorex and Ranorex.Core in my using statements?
Thanks,
Jason
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: Passing objects to methods that aren't visible
The RepoItemInfo is just a helper class that stores the RanoreXPath (and some additional info) for a repository item. Is has been introduced with Ranorex V2.2. The following using statement should help getting rid of the compiler error:
Alex
Ranorex Support Team
using Ranorex.Core.Repository;Regards,
Alex
Ranorex Support Team