A humidity sensor, also called a hygrometer, measures and regularly reports the relative humidity in the air. Humidity sensors can also be used in cars, office and industrial HVAC systems, and in meteorology stations to report and predict weather. In solids it can be as simple as Weight-Dry-Weigh or as complex as Infrared Absorption Spectroscopy.
Measurement in liquids is yet another story and there the devices used for measurement of dewpoint temperature work quite well as long as the gases are not too hot or too corrosive.
This kind of sensors are used in robots where the sensing of the outside environment is required.