← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #674765]: Unable to use the new friendly text methods through api 1.1.4

 

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

Rev Kapuganti posted a new comment:
Thanks Raiman.

Yes I'm using just the sikulixapi.jar(1.1.4) with my cucumber(jruby)
suite. My development IDE is  Rubymine.

Here is how I'm loading sikulix api into my test project -

class Platform
    def self.sikulix_path
      path = "#{ENV['SIKULIX_HOME']}"
      if ENV['SIKULIX_HOME'].nil?
        raise LoadError, "Failed to load 'sikuli-api1.4.jar'\nMake sure SIKULIX_HOME is set!, Refer instructions on the git repo"
      end
      return  path
    end
end


And then load as(as you  suggested) :

require Platform.sikulix_path


java_import 'org.sikuli.script.Screen'
java_import 'org.sikuli.script.Region'
java_import('org.sikuli.script.App')


<Find an image on my app under test> . # Using mac - cannot focus on the app directly! A workaround you suggested in your other answers

app_window = App.focused_window.

# All the below errored out.  (just the find_text or print_text works!)

        app_window.collect_words.each do |match|
          puts match.get_text
        end

       or

        Region.new(app_window).collect_lines.each do |match|
          puts match.get_text
        end

    or

        Region.new(@screen).collect_words_text.each do |wt|
          puts wt
        end

   or

         @screen.collect_lines_text.each do |lwt|
          puts lw
        end


I will try with  java_importing  all the script packages classes like
you suggested.

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.