← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #234149]: Issues with type() wrapper method in Java

 

Question #234149 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/234149

Description changed to:
Hi there,

I'm working on a test suite for one of our applications and I have come
across some issues with creating wrapper methods. In a parent class I
have this code:

protected void type(String phrase) throws FindFailed
{
		window.type(phrase);
}

In the child class I have this code:

public void enterURL() throws Exception
{
		type("www.google.com");
		keyDown.(Key.ENTER);
		keyUp(Key.ENTER);
}

Note that the keyDown and keyUp methods are also wrapper methods.
Anyway, when I try to call this enterURL() method I sometimes get a
NullPointerException and it fails at type("www.google.com");. Any idea
why this is? This happens with other wrapper methods I have made as
well, e.g. click() and paste(). The reason I have these wrapper methods
is so that if I have to change some code, I only have to change it in 1
place as opposed to hundreds of places.

I should also note that if I change type("www.google.com"); to
window.type("www.google.com"); (where window is a Region), then it will
type it out.

Thanks in advance!

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.