We propose a novel and effective online method for performing diagnosis of scan chains with the physical defective circuits in the loop. We first apply flush tests to determine the faulty chains and their corresponding fault types. Then, we generate new patterns using an evolutionary algorithm and quickly analyze the responses to perform diagnosis. We are able to achieve an average of 70% and 37% improvement in the diagnosis quality for the segmented and non-segmented scan chains respectively, as compared to a state-of-the-art offline industry tool, when 0 to 7 faults were randomly inserted in each scan chain. Our method does require additional tester time, which may be preferred to the computational, setup and overhead costs of the offline diagnosis, especially during the yield learning process.