Determination of the electric field near a separatrix in diverted tokamaks