WebApp: Silverlight: Spreadsheet: How to find a collumn

Asked by Akash ARK

Hi,

I am trying to identify a region and text box and need to provide some input to it. This is my code snipped

 public static boolean inputTextBoxBasedRegion(String regionpath,String textBoxpath,String inputText){
  boolean result =false;

  Pattern textBoxWindow = new Pattern(regionpath);
  Pattern textBox = new Pattern(textBoxpath);
  Region testregion = new Screen();

  try{
   testregion = testregion.find(textBoxWindow.similar((float).9));
   testregion.inside().click(textBox, 0);
   screen.type(inputText);

  } catch (FindFailed e)
  {
   e.printStackTrace();
  }

  return result;

 }

I am calling this function from a seperate class

    inputTextBoxBasedRegion(regionCustomerCityPath,textBoxCityPath,"LeatherHead");

For One object it is recognising and for the other it is not recognising.. it is a excel kind of webpage where we have to fill muliple columns.. it identified the first column and then then jumped to fourth and thrwoing error for all fields.
Not sure. i tried to execute only the command specific to the error script excluding the success commands..still its failing. any inputs please

Question information

Language:
English Edit question
Status:
Answered
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

Such cases are very hard to judge without a screenshot.

Your code should principally work.

--- it is a excel kind of webpage where we have to fill multiple column
If you have a more regular kind of field pattern it is usually easier and faster to find some reference points and then click relative to these points with calculated offsets.

Revision history for this message
Akash ARK (id4selenium) said :
#2

Hi RaiMan,

Thanks for that input.

I wont be able to use a reference point. the one main reason is.. it is excel kind of application, but the user keeps changing the column as they need. so I thought of Identifying with the image and the textbox.It worked when i passed the very first text box field. but not working when i m trying to get a region of second one.

Also, do u have a code which tells how to use the relative reference points. Could you share them please?

I am not sure about how to add a screenshot, but this website should help.
http://labs.infragistics.com/silverlightdv/Showcases/SalesReporting/

Click on the customer tab, we need to fill all the empty columns.

Revision history for this message
RaiMan (raimund-hocke) said :
#3

Ok, since it is really a challenge, to solve such a case visually with the features of Sikuli, I have made a little showcase based on your Silverlight showcase from above.

downlioad and unzip: http://dl.dropbox.com/u/42895525/silverlight.sikuli.zip

This shows, how I usually try to find a way to a solution with Sikuli.
The commented ...highlight()'s are for debugging and fine tuning purposes.

The script shows some basic possible approaches.
To transpose it to Java is your job ;-)

This was made on Mac Lion in Safari browser, so you have to adapt it to Windows (the webpage should be open already).
Since there might be rendering differences between systems/browsers, you may have to recapture the images, to get the example running.

Can you help with this problem?

Provide an answer of your own, or ask Akash ARK for more information if necessary.

To post a message you must log in.