自动化脚本疑问

按前面来说,下面这几行代码打印结果为:

hao123_上网从这里开始

NBA_腾讯体育_腾讯网_NBA中国数字媒体独家官方合作伙伴

腾讯首页

但是结果为:

hao123_上网从这里开始

NBA_腾讯体育_腾讯网_NBA中国数字媒体独家官方合作伙伴

腾讯首页

是不是因为最前面循环判断句柄时切换过一次句柄(切换到腾讯首页),然后腾讯首页的句柄号变成了1?

driver.swithc_to.window(all_handles[0])

print(driver.title)

driver.swithc_to.window(all_handles[1])

print(driver.title)

driver.swithc_to.window(all_handles[2])

print(driver.title)

原文地址:https://www.cnblogs.com/yaoze2018/p/9874067.html