This paper introduces a novel approach for analyzing the frictionless two-dimensional contact between dielectric solids in an electrostatic medium. This analysis is achieved by combining the finite element and boundary element methods. The finite elements model elastic dielectric solids undergoing geometrically nonlinear mechanical deformation and electric polarization. We present a finite element-based contact formulation to address the electromechanical contact between dielectric solids. To enforce the contact condition, we employ the nested augmented Lagrangian method. In contrast, the boundary element method is applied to consider the electrostatic medium surrounding the dielectric solids. The boundary elements are coupled with the finite elements on the surfaces of the dielectric solids. This coupling and elaborate treatment of transition zones between contacting and non-contacting solid surfaces ensures accurate capture of electrical interactions along all boundaries. Our proposed method successfully passes a contact patch test even with non-matching meshes. To further validate the effectiveness of our approach, we provide numerical examples that explore the impact of piezoelectricity and flexoelectricity. These examples demonstrate the applicability of the proposed method.