How to get visible options' count of HTML select tag, with multiple attribute set, while size not set?
<p>In my case, I want to get the <strong>select</strong> element's visible options' count (By visible options' count, I mean <strong>how many options are visible without scrolling</strong>. Thanks Matthew). If <strong>size</strong> attribute is set, then <em>element.size</em> is the value I need. When it isn't, things get a little tricky.</p>

<p>For example, in following code:</p>

<pre><code>&lt;select multiple="multiple"&gt;
    &lt;option&gt;text1&lt;/option&gt;
    &lt;option&gt;text2&lt;/option&gt;
    &lt;option&gt;text3&lt;/option&gt;
&lt;/select&gt;
</code></pre>

<p>In IE/Chrome/Firefox, it will show like the picture below. In this case, <em>count</em> should be 3:</p>

<p><a href="https://i.stack.imgur.com/Wnp8x.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Wnp8x.png" alt="in this case, count should be 3"></a></p>

<p>If option count in previous case is greater than 4, it still shows 4 visible lines. In this case, <em>count</em> should be 4:</p>

<p><a href="https://i.stack.imgur.com/F4FsI.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/F4FsI.png" alt="in this case, count should be 4"></a></p>

<p>Is there a good way, other than using <em>if...else...</em>, to get the visible options' count of <strong>select</strong> tag, in any circumstances?</p>

<p>FYI, I'm developing a test software to do functional testing for customers' website, so I'm not able to modify code of the web page.</p>