robertwahler / win32-autogui

A Ruby Win32 GUI testing framework packaged as a RubyGem
http://www.gearheadforhire.com/articles/ruby/win32-autogui/using-ruby-to-drive-windows-applications
MIT License
52 stars 6 forks source link

invalid byte sequence in US-ASCII #12

Open wstaples opened 9 years ago

wstaples commented 9 years ago

Hello,

I'm attempting to automate a microsoft access database using cucumber. I can create a new instance of the application using

app = Source_Code_Database.new

I can get the process id with

app.pid

however when I try to do anything else like: app.main_window.window_class or app.main_window.children.count

I get the error "invalid byte sequence in US-ASCII (ArgumentError)"

Here is the class I'm using

class Source_Code_Database < Autogui::Application
    def initialize()
        @access_dir = 'C:/Program Files (x86)/Microsoft Office/Office14/msaccess.exe'
        @database_dir = File.absolute_path('../code/campaign_codes.accdb')
        @launch_string = "\"#{@access_dir}\" \"#{@database_dir}\"".gsub("/", "\\")
        super :name => @launch_string, :title => 'Microsoft Access - campaign_codes : Database (Access 2007 - 2010)', :logger_level => Autogui::Logging::DEBUG
    end 
end

Everything is english I am on Windows 7 64bit Ruby 1.9.3p448 (2013-06-27) [i386-mingw32] win32-autogui (0.5.2)

robertwahler commented 9 years ago

At a guess, I'd say this is the same as the unresolved issue #6. Somewhere along the line an ANSI Win32 API is getting a wide character.

The real fix is to resolve issue #6 though it might be possible to throw some exception trapping around some of the API calls if you can narrow down where the non ASCII text is coming from.