For someone that has only been programming for 7 days this isn't too bad. At least you are commenting things fairly well, which most newbies do not do.
I personally use: select.selectByValue(valueString);
So I haven't used selectByVisibleText(). I wonder if you need to click on the select element to make the list visible for that to work or not, but I am guessing it should work as you are trying to use it here.
One thing you need to do is remove your sleep() calls. You are wasting 30 minutes here in sleeps just for a single test!
Either enable implicit waits or use a routine to verify the element is present (I use the latter method, so I can change the time to wait).
You also have a weird if-else:
if (verifiedfont.contains(availfontget)) {
} else{
throw new Exception("font type not correct") ;
}
This should be:
if (!verifiedfont.contains(availfontget)) {
throw new Exception("font type not correct") ;
}
I had an instructor that said never to use the not operator (!) in an if, but that is a load of ....
I would also do a find of the select in your calling routine, so you only do it once, and pass it to the availfonts method. Otherwise you do a whole new search every time. You don't need to do that unless your select in the routine causes the original one to go stale by changing the page.
Mike