I need to validate color in Edit box. this is my code:
def get_sn_edit_box_rgb(self):
tup = (1182, 227, 1884, 249)
(x, y) = self.calculate_element_center_points(tup)
(r,g,b)=self.get_pixel_colour(x, y)
I hard coded the rectangle coordinates of the box , but i want to get it dynamically.
I tried using 'GetProperties' and 'Rectangle' methods but received an error " WindowSpecification class has no '---' method"
'get_properties' method some error from pywinauto inner block
I found it , thanks to G-d!
rec = self.dlg.child_window(auto_id="tSerialNumber").element_info.rectangle
final version will look like:
def get_sn_edit_box_rgb(self):
rec = self.dlg.child_window(auto_id="tSerialNumber").element_info.rectangle
mid = rec.mid_point()
(r,g,b)=self.get_pixel_colour(mid.x, mid.y)
return (r,g,b)