Extend the Adapter Class
Posted: Fri Sep 19, 2014 11:05 pm
Hi ...
We are wondering if this might be a good case to extend the Adapter Class. We have developed a method called waitForVisible() that is called each time we execute an operations (i.e. Click(), DoubleClick() ...) that will open a new window.
We've been thinkin' - maybe we should add this functionality into the Adapter Class.
What do you think?
Here is a sample use case for the waitForVisible()
Now - if we extended the Adapter Class - we could add the waitForVisible() functionality into the Click() method.
One question would be how to implement the new AdapterExt Class with the RanorexPath ???
Would I need to do something like this t to initialize the AdapterExt ??
Looking at the code below how sure how to implement AdapterExt ??
We are wondering if this might be a good case to extend the Adapter Class. We have developed a method called waitForVisible() that is called each time we execute an operations (i.e. Click(), DoubleClick() ...) that will open a new window.
We've been thinkin' - maybe we should add this functionality into the Adapter Class.
What do you think?
Here is a sample use case for the waitForVisible()
Code: Select all
Report.Info("Open the LibraryReference in the Trademark Editor");
repo.JSA.Features.LibraryReference.LibraryReferenceArtifact.DoubleClick();
if (!SummaryHelper.waitForVisible(repo.JSA.LibraryReference.X,
WAIT_FOR_VISIBLE_TIMEOUT_MS,
"LibraryReference Editor didn't open"))
{
Report.Failure("LibraryReference Editor didn't open");
}
else
{
repo.JSA.LibraryReference.SaveAndCloseButton.Click();
}
Code: Select all
public class AdapterExt : Adapter
{
private string[] requiredCapabilities;
public AdapterExt()
{
requiredCapabilities = new string[] {};
}
protected override string[] RequiredCapabilities
{
get { return requiredCapabilities; }
// set { requiredCapabilities = value; }
}
// This method will extent the Click() method that is found in the
// Adapter class
public void Click()
{
Click();
// Add some extended functionality here
}
}
Would I need to do something like this t to initialize the AdapterExt ??
Looking at the code below how sure how to implement AdapterExt ??
Code: Select all
// Create Text adapter from RanoreXPath
Text textBox = "/form[@controlname='TestedApp']/text[@controlname='label3']";
// Set text value of text box
textBox.TextValue = "12";
// Check on of the 'General' properties
if (textBox.Enabled)
Report.Info("Text is enabled");