Why is selenium not looping properly