Improve test nosTabSelected, check if tab exist first