Technology specific object identification, supported applications, web technologies, and 3rd party controls.
-
andy.simpson
- Posts: 51
- Joined: Fri Jun 22, 2018 8:59 am
Post
by andy.simpson » Mon Apr 08, 2019 10:21 am
Hi, me again
I have a scenario where we have a standard indexing screen where fields are enabled/disabled for each customer as they require them. Ideally I want to have a code module which can dynamically index the boxes based on whether they are enabled/disabled by using a data driven excel spreadsheet with the repo elements being passed in as variables. This seems to work apart from the fact that adapters cannot be variables as shown here
how-to-force-ranorex-adapter-to-be-used ... 11876.html
Its notes here that using a * as an adapter rather than passing the adapter in but I'm unclear as to how this actually works.
On a broader note is this a good solution or is there better way of going about it? really want the repo items to be data driven to save having multiple recording modules for the different configurations of index screen
I've attached a snapshot, & screenshots of my code module an data driven info
again any advice would be appreciated
-
Attachments
-
- disabled snapshot.rxsnp
- (149.16 KiB) Downloaded 21 times
-

- DataDrivenExcel.PNG (52.49 KiB) Viewed 628 times
-

- Code for a data driven repo elements.PNG (23.08 KiB) Viewed 629 times
-
manish
- Posts: 47
- Joined: Fri Aug 10, 2018 12:46 pm
Post
by manish » Mon Apr 08, 2019 3:11 pm
Hi,
Instead of Adapter as the Type, you could try to use Ranorex.ElementType if you alread know the Type of FieldToBeValidated.

- Untitled.png (16.73 KiB) Viewed 611 times
Also, if this does not work or if you do not know the type of elemnt beforehand, you could use

- Unbenannt1.png (5.11 KiB) Viewed 611 times
Hope it solves the issue
Thanks
Manish
-
andy.simpson
- Posts: 51
- Joined: Fri Jun 22, 2018 8:59 am
Post
by andy.simpson » Fri Apr 12, 2019 8:45 am
Sorry I'm not sure I quite understand your explanation
-
Support Team
- Site Admin

- Posts: 12167
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Graz, Austria
Post
by Support Team » Tue Apr 16, 2019 12:26 pm
Hello Andy,
The column "Repository RxPath" in your screenshot doesn't contain a RxPath, it contains the classpath to the object represented as a string. Your method expects an Adapter object.
I would recommend using the RanoreXPath instead, then you can use Unknown instead of the adapter.
public void ClickMyElement(string MyRxPath)
{
Ranorex.Unknown myElement = MyRxPath;
myElement.Click();
}
I hope this helps.
Regards,
Bernhard
.

-
andy.simpson
- Posts: 51
- Joined: Fri Jun 22, 2018 8:59 am
Post
by andy.simpson » Thu Apr 18, 2019 1:41 pm
That works thanks

Am I right in thinking that if I want to validate an adapter attribute (like its class) against a data driven spreadsheet then there is no way of achieving this other than to have a separate adapter for each validation?
-
Support Team
- Site Admin

- Posts: 12167
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Graz, Austria
Post
by Support Team » Tue Apr 23, 2019 12:04 pm
Hi andy,
You can use the following code to get the value of the class property, but be careful, not every element has a class property.
myElement.Element.GetAttributeValue("Class");
Regards,
Bernhard
.
