Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/427.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/selenium/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript .style.backgroundColor错误_Javascript_Selenium_Ide - Fatal编程技术网

Javascript .style.backgroundColor错误

Javascript .style.backgroundColor错误,javascript,selenium,ide,Javascript,Selenium,Ide,以下是我的脚本(在Selenium IDE中): 您的代码正在查找element类型的元素,如下所示: <element>Something</element> elements.item(i).style.backgroundColor 您的代码正在查找element类型的元素,如下所示: <element>Something</element> elements.item(i).style.backgroundColor 与此相反: w

以下是我的脚本(在Selenium IDE中):


您的代码正在查找
element
类型的元素,如下所示:

<element>Something</element>
elements.item(i).style.backgroundColor

您的代码正在查找
element
类型的元素,如下所示:

<element>Something</element>
elements.item(i).style.backgroundColor
与此相反:

window.document.getElementsByTagName(“元素”).item(i).style.backgroundColor

只要用这个:

元素[i].style.backgroundColor
而不是此:

window.document.getElementsByTagName(“元素”).item(i).style.backgroundColor

只要用这个:


elements[i].style.backgroundColor

发布您的代码并创建一个提琴,需要更多信息来帮助您。现在似乎“elements”对象没有被提取。发布您的代码并创建一个fiddle,需要更多信息来帮助您。现在看来“元素”对象没有被提取。哦,非常感谢。对不起,我犯了个愚蠢的错误。我感到惭愧–user1211063
document.forms[0]
只是页面上第一个表单的快捷方式(表单是所有表单的数组),元素是该表单中所有输入标记数组的快捷方式-因此无需再次“获取”它们,它们已经在dom中为您选择了…哦,非常感谢。对不起,我犯了个愚蠢的错误。我感到惭愧–user1211063
document.forms[0]
只是页面上第一个表单的快捷方式(表单是所有表单的数组),而元素是该表单中所有输入标记数组的快捷方式-因此无需再次“获取”它们,它们已经在dom中为您选择了。。。