Closed BurdetteLamar closed 13 years ago
To be honest, this is actually as it is meant to work since hwnd is unique. Due to that reason there's no point to even look at other locators if handle is specified. I guess this should be brought out better in the documentation...
Possible language: If locator :hwnd is included, any other locators given are ignored; the window is found or not based only on the :hwnd locator.
Used a slightly different wording - https://github.com/jarmo/RAutomation/commit/f1fb34e7c192147dd777332855aefcfce5d3bbc7
A call to method Window#new whose locators include a valid :hwnd always finds the window with the given hwnd, even if none of the other locators given match that window.
From the doc: "Use multiple locators, every locator will be matched (AND-ed) to the window."
Here's a test that produces the behavior by calling with a valid :hwnd, and with all other locators not matching the window. The assertion fails.
require 'test/unit' require 'rubygems' require 'rautomation'
class BugDemo < Test::Unit::TestCase
def setup thread = Thread.new {
calc.exe
} Thread.pass sleep 1 @@calculator_window = RAutomation::Window.new(:title => 'Calculator') enddef teardown @@calculator_window.close end
def test_bug_demo
This window should not be found,
end
end