Python 指定的对象不可索引

Python 指定的对象不可索引,python,testcomplete,Python,Testcomplete,根据smartbear官方网站上给出的示例 # The following routine checks the width and height attributes of # IMG elements located on a web page. def Test(): # Obtains the page object url = "****"; Browsers.Item[btChrome].Run(url); page = Sys.Browser("*

根据smartbear官方网站上给出的示例

# The following routine checks the width and height attributes of
# IMG elements located on a web page.

def Test():
    # Obtains the page object
    url = "****";
    Browsers.Item[btChrome].Run(url);
    page = Sys.Browser("*").Page("*");

    # Obtains the page's images
    images = page.contentDocument.images;
    Log.Message(images.length)

    for img in images:    # <<<<<<<This is the error
        # other calculating stuff
#以下例行程序检查
#位于网页上的IMG元素。
def Test():
#获取页面对象
url=“****”;
Browsers.Item[btChrome].Run(url);
页面=系统浏览器(“*”)。页面(“*”);
#获取页面的图像
images=page.contentDocument.images;
Log.Message(images.length)

对于图像中的img:#目前不支持使用此图像数组作为可索引集合。您在上引用的示例具有不同的代码:

for i in range (0, images.length-1):

我认为您至少应该提供一个完整的回溯以获得帮助。@Sraw,testcomplete没有提供那么多的回溯,RuntimeError指定的对象不可索引就是全部。@YuZhang也许您可以使用列表对其进行迭代comprehension@AluanHaddad,谢谢,我会看看的是的,我试过这个,也没用。我修改了代码,然后发布了我的代码。很奇怪,他们声称它应该有效,但事实上没有得到支持。从未声称支持此功能。我想你被另一个脚本示例弄糊涂了。