Cache IWebElement before checking TagName is correct (#8904)
Cache IWebElement before checking TagName is correct (#8904)

When creating a SelectElement we must first check the WrappedElement tag is select and throw a UnexpectedTagNameException otherwise.

Previously the WrappedElement was not cached so WebDriver API could be called up to three times: first to check the tag is not null, second to check it's value is select (ignoring case) and a third time as a parameter of UnexpectedTagNameException if any of the previous conditions failed.

Fixes #8899

Co-authored-by: elgato <72e1206bec8a9c6af30210b62347cd83eb86efe7@gmail.com>
titusfortner/selenium,Ardesco/selenium,valfirst/selenium,titusfortner/selenium,SeleniumHQ/selenium,joshmgrant/selenium,Ardesco/selenium,Ardesco/selenium,joshmgrant/selenium,HtmlUnit/selenium,joshmgrant/selenium,titusfortner/selenium,HtmlUnit/selenium,SeleniumHQ/selenium,HtmlUnit/selenium,joshmgrant/selenium,valfirst/selenium,titusfortner/selenium,SeleniumHQ/selenium,Ardesco/selenium,HtmlUnit/selenium,SeleniumHQ/selenium,joshmgrant/selenium,valfirst/selenium,valfirst/selenium,SeleniumHQ/selenium,HtmlUnit/selenium,SeleniumHQ/selenium,titusfortner/selenium,valfirst/selenium,Ardesco/selenium,titusfortner/selenium,joshmgrant/selenium,Ardesco/selenium,valfirst/selenium,SeleniumHQ/selenium,valfirst/selenium,Ardesco/selenium,titusfortner/selenium,HtmlUnit/selenium,valfirst/selenium,HtmlUnit/selenium,Ardesco/selenium,joshmgrant/selenium,HtmlUnit/selenium,joshmgrant/selenium,titusfortner/selenium,valfirst/selenium,titusfortner/selenium,joshmgrant/selenium,titusfortner/selenium,SeleniumHQ/selenium,valfirst/selenium,titusfortner/selenium,HtmlUnit/selenium,SeleniumHQ/selenium,Ardesco/selenium,joshmgrant/selenium,valfirst/selenium,SeleniumHQ/selenium,SeleniumHQ/selenium,HtmlUnit/selenium,joshmgrant/selenium