Dean Elgar grabbed his opportunity created by the retirement of Graeme Smith to score his second Test match century and his first in his specialist position of opening batsman on the opening day of the first Test match against Sri Lanka at Galle on Wednesday.