Sha256: 9f1ccbea63135e4cd8413c879b0325156e84419eef7b8117fe6a10c2c239afa4
Contents?: true
Size: 1.71 KB
Versions: 1
Compression:
Stored size: 1.71 KB
Contents
module RAutomation module Adapter module WinFfi class ListBox < Control include WaitHelper include Locators def count UiaDll::find_children(uia_control(@locators[:id]), nil) end def items list_items = [] children = FFI::MemoryPointer.new :pointer, self.count length = UiaDll::find_children(uia_control(@locators[:id]), children) children.read_array_of_pointer(length).each do |child| child_name = FFI::MemoryPointer.new :char, UiaDll::get_name(child, nil) + 1 UiaDll::get_name(child, child_name) list_items.push child_name.read_string end list_items end def exist? @locators[:id].nil? ? super : super && matches_type(Constants::UIA_LIST_CONTROL_TYPE) end alias_method :exists?, :exist? def selected?(index) children = FFI::MemoryPointer.new :pointer, self.count length = UiaDll::find_children(uia_control(@locators[:id]), children) target_element = children.read_array_of_pointer(length)[index] is_selected = FFI::MemoryPointer.new :int, 1 if UiaDll::get_is_selected(target_element, is_selected) == 1 return is_selected.read_int == 1 else return false end end def select(index) children = FFI::MemoryPointer.new :pointer, self.count length = UiaDll::find_children(uia_control(@locators[:id]), children) target_element = children.read_array_of_pointer(length)[index] UiaDll::select(target_element) end alias_method :strings, :items end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rdp-rautomation-0.6.3.1 | lib/rautomation/adapter/win_ffi/list_box.rb |