Solid state relay (SSR40) behaves weird
when I connect the main line to AC in of the SSR I checked the continuity from both terminals, it says no continuity at all.


You cannot test a solid state relay with Multi-meter. these devices require a minimum amount of voltage/current across the input before the output device will conduct. Most multimeters are designed to simply provide a small amount of voltage in order to measure the ensuing current draw. Therefore, when measuring a solid-state device, the meter will typically report an open circuit (or very high impedance) because it cannot put out enough to turn on the relay.

Please follow  this link  for more details

the image below is the schematic of an solid state relay. The triac in the solid state relay is going to turn-on and off when there is supply and load connected across it. then only the driver will work.

In order to keep the traic in on-state after gate trigger there needs to be minimum holding current to be present.



Image source: https://www.galco.com/comp/prod/relay.htm


  But for some reason I tested the other terminal using a Tester as in the below picture it turns on which means there is current flowing from 1 to 2 without DC input. But why no continuity even then? 


this is due to leakage currents.