It depends. There are three cases to consider:
- The page does not have a favicon.
- The page has a favicon by virtue of a
favicon.ico file located in the website's root but does not specify the favicon in HTML.
- The page specifies a favicon using a
link element in HTML.
Selenium cannot distinguish between cases (1) and (2).
Selenium can check for case (3) the same way you would check for any other element, e.g. using a XPath selector. For example, if your
link looks like this:
<link rel="shortcut icon" href="http://example.com/myicon.ico" />
then you might check for that element with an XPath like this:
Wikipedia's favicon page has a list of other ways to specify the