如何检查'select'是否有一些选项?

时间:2012-03-22 12:33:08

标签: php testing selenium phpunit



我正在使用 Selenium &编写测试脚本的 PHPUnit的即可。
我有一个包含下拉列表的表单。我必须验证是否从数据库中读取数据并将其作为选项显示在' select'元素。

如果选择中没有选项,则代码为:

<select id="list">

</select>


方法assertNotEmpty("list")不起作用。

有什么想法吗?

2 个答案:

答案 0 :(得分:0)

`if(document.getElementById('list')。innerHTML!==“”)

//做某事` - 可能在资源管理器中不起作用。

答案 1 :(得分:0)

您可以使用 int offset = 7; // Maximum range taking effect float offsetScales[offset+1] = { // +1 is for the zero offset 0.159576912161, 0.147308056121, ... }; highp vec4 summedColor = vec4(0.0); // We best take a large value now highp float overallAlpha = 0.0; // The actual end alpha (previously sumOfScales) highp float overallScale = 0.0; // We need this one so alpha doesn't overflow. If the sum of original scales is 1.0 then this factor is 1.0 and is not needed at all. vec4 fetchedColor = texture2D(u_texture, v_texCoord); float scaleWithAlpha = fetchedColor.a * offsetScales[0]; overallScale += offsetScales[0]; summedColor += fetchedColor*scaleWithAlpha; overallAlpha += scaleWithAlpha; for(int i=0; i<offset; i++) { vec4 fetchedColor = texture2D(u_texture, v_blurTexCoords[6-i]); float scaleWithAlpha = fetchedColor.a * offsetScales[i+1]; overallScale += offsetScales[i+1]; summedColor += fetchedColor*scaleWithAlpha; overallAlpha += scaleWithAlpha; fetchedColor = texture2D(u_texture, v_blurTexCoords[7+i]); scaleWithAlpha = fetchedColor.a * offsetScales[i+1]; overallScale += offsetScales[7+i]; summedColor += fetchedColor*scaleWithAlpha; overallAlpha += scaleWithAlpha; } overallAlpha /= overallScale; summedColor /= overallAlpha; // TODO: if overallAlpha is 0.0 then discard or use clear color gl_FragColor = vec4(summedColor.xyz, overallAlpha); 函数获取一系列选项。

selectOptionValues()

希望这有助于解决您的问题。