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
Workaround for having an adapter as a variable
-
- Posts: 59
- Joined: Fri Jun 22, 2018 8:59 am
Workaround for having an adapter as a variable
You do not have the required permissions to view the files attached to this post.
Re: Workaround for having an adapter as a variable
Hi,
Instead of Adapter as the Type, you could try to use Ranorex.ElementType if you alread know the Type of FieldToBeValidated.
Also, if this does not work or if you do not know the type of elemnt beforehand, you could use
Hope it solves the issue
Thanks
Manish
Instead of Adapter as the Type, you could try to use Ranorex.ElementType if you alread know the Type of FieldToBeValidated.
Also, if this does not work or if you do not know the type of elemnt beforehand, you could use
Hope it solves the issue
Thanks
Manish
You do not have the required permissions to view the files attached to this post.
-
- Posts: 59
- Joined: Fri Jun 22, 2018 8:59 am
Re: Workaround for having an adapter as a variable
Sorry I'm not sure I quite understand your explanation
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: Workaround for having an adapter as a variable
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.
Regards,
Bernhard
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
-
- Posts: 59
- Joined: Fri Jun 22, 2018 8:59 am
Re: Workaround for having an adapter as a variable
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: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: Workaround for having an adapter as a variable
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.
Bernhard
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
-
- Posts: 59
- Joined: Fri Jun 22, 2018 8:59 am
Re: Workaround for having an adapter as a variable
Great thanks