This paper discusses a novel step by step path planning method which uses genetic algorithm (GA) to find the feasible and suitable paths in an environment with static and dynamic obstacles. To increase the speed of calculations, dimension of the search space is reduced by developing a new method to represent the environment. This representation method is based on detecting the corners of circumferential polygons of all obstacles as representatives of the environment. Each individual (or path) is a subsequence of these points including the start and destination points as the first and last genes in the sequence. Thus, each individual will be of a variable length. If an individual represents a path which passes over some obstacles, it will be unfeasible; otherwise it represents a feasible path. To produce new generations, four evolutionary operators are defined. The goal is to find a short feasible path, which clearly is not unique. In addition, using a step by step path planning approach and updating the representation of the environment at each step will result in a robust performance of the algorithm in two dimensional (2D) static and dynamic environments.