For example, would a green lizard know it need to stay on a leaf, and avoid creeping on ground? Or in general, would animals with crypsis know what color they are and then hide on suitable place? Or they don't planned to do it and just be unlucky if they leave their suitable place and be seen by predators?
I think you can break this down into two sub-questions:
Will natural selection select animals whose crypsis and behavior align with each other? The answer here is definitely yes, but with a few caveats:
Crypsis might not be the best strategy in a particular situation: a green lizard crawling on a leaf might be outcompeted with a red-and-blue lizard that is poisonous, for instance.
Either behavior or crypsis might be easier to change over evolutionary time: you might see your green lizard evolving to spend more time in leaves (particularly if it's herbivorous or eats plant-dwelling insects), or you might see it evolving brown pigmentation to hide on the ground.
Natural selection isn't going to be concerned with individual actions but overall behavior. So a lizard might fall off a bush, get spotted on the ground and eaten. But it might dash from bush to bush without getting caught. But if a lizard spends most of its time on leaves, there might be selection towards it being well-camouflaged on leaves.
Does this require a conscious decision on the animal's part? I think the answer here is no, consciousness isn't necessary. Very simple animals show responses to their environment, such as bacteria swimming towards food. Your green lizard might be staying close to leaves that it feeds on, or near the insects it feeds on that itself feed on the leaves, and so stay near the green leaves that camouflage it by accident. Or its brain might be programmed to carry out a complex action to hide it better. Perhaps the most sophisticated examples of this is animals that reconfigure their body to match their surroundings, such as octopuses, cuttlefish (but not, interestingly enough, chameleons!)
This doesn't mean that the animals don't have consciousness or are not deliberately hiding by finding surroundings that match themselves. It just means that that's not necessary to explain why we find green lizards hanging out on leaves.