Add query element method and Add unit test for it