Hi Team,
This is Dimbre. First of all my sincere appoligies if I am asking anything bad here.
I am doing something like following
Ranorex.WebDocument uname = "/dom[@domain='burjira.dub.usoh.ibm.com:6777' and @caption~'^Issue']";
This do works fine and locates the UI object, but my question here is how is this above code working. Here we are assigning string value object of type Ranorex.WebDocument
I am trying to do similar thing as explained below but it fails
///Created a class named "MyClass" which is child of "Ranorex.WebDocument"
namespace Automation
{
public class MyClass : Ranorex.WebDocument
{
}
}
//Following does not work
MyClass dumObj1 = new MyClass();
dumObj1 = "/dom[@domain='burjira.dub.usoh.ibm.com:6777' and @caption~'^Issue']"; //Here it says 'Cannot implicitly convert type string to Automation.MyClass'.
Requesting you kind assistance here.
Thanks and Regards,
SDimbre
inheriting a class give error
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: inheriting a class give error
Hi Dimbre,
Is there a special reason why you create a custom class which derives from the "Ranorex.WebDocument" adapter?
Maybe this can be handled in another way?
Can you please explain your use case?
Thanks,
Markus
Is there a special reason why you create a custom class which derives from the "Ranorex.WebDocument" adapter?
Maybe this can be handled in another way?
Can you please explain your use case?
Thanks,
Markus
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: inheriting a class give error
Hello,
It seems that you are missing a few steps (e.g. constructor) in order to inherit this class.
Please take a look at the following links:
Using Constructors in C#
Inheritance and Derived Classes (C# vs Java)
C# - Making all derived classes call the base class constructor
You could find a useful example how to inherit a class in the following post:
http://www.ranorex.com/forum/custom-ran ... html#p4855
Regards,
Markus (T)
It seems that you are missing a few steps (e.g. constructor) in order to inherit this class.
Please take a look at the following links:
Using Constructors in C#
Inheritance and Derived Classes (C# vs Java)
C# - Making all derived classes call the base class constructor
You could find a useful example how to inherit a class in the following post:
http://www.ranorex.com/forum/custom-ran ... html#p4855
Regards,
Markus (T)
Re: inheriting a class give error
Hi Markus,
Thanks for the reply.
By doing this I can add my own specific behavior for method provided by this class. And Same way I can do for other classes also.
But as explained stuck in first phase and not able to implement further.
///Created a class named "MyClass" which is child of "Ranorex.WebDocument"
namespace Automation
{
public class MyClass : Ranorex.WebDocument
{
}
}
//Following does not work
MyClass dumObj1 = new MyClass();
dumObj1 = "/dom[@domain='burjira.dub.usoh.ibm.com:6777' and @caption~'^Issue']"; //Here it says 'Cannot implicitly convert type string to Automation.MyClass'.
Thanks,
SDimbre
Thanks for the reply.
By doing this I can add my own specific behavior for method provided by this class. And Same way I can do for other classes also.
But as explained stuck in first phase and not able to implement further.
///Created a class named "MyClass" which is child of "Ranorex.WebDocument"
namespace Automation
{
public class MyClass : Ranorex.WebDocument
{
}
}
//Following does not work
MyClass dumObj1 = new MyClass();
dumObj1 = "/dom[@domain='burjira.dub.usoh.ibm.com:6777' and @caption~'^Issue']"; //Here it says 'Cannot implicitly convert type string to Automation.MyClass'.
Thanks,
SDimbre
Support Team wrote:Hi Dimbre,
Is there a special reason why you create a custom class which derives from the "Ranorex.WebDocument" adapter?
Maybe this can be handled in another way?
Can you please explain your use case?
Thanks,
Markus
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: inheriting a class give error
Hello SDimbre,
It seems that you have missed to add two implicit cast operators and a constructor to your class.
Please take a look at class file 'MyAdapter.cs' posted in our forum.
This should give you an idea how to do that:
http://www.ranorex.com/forum/custom-ran ... html#p4855
Regards,
Markus (T)
It seems that you have missed to add two implicit cast operators and a constructor to your class.
Please take a look at class file 'MyAdapter.cs' posted in our forum.
This should give you an idea how to do that:
http://www.ranorex.com/forum/custom-ran ... html#p4855
Regards,
Markus (T)