Replaced at_css with xpath and got fixed the bug.