Definition of trial and error:
(n) :
the process of finding a solution to a problem by trying many possible solutions and learning from mistakes until a way is found
"navigating by trial and error may get you there eventually, but using a map is faster."