Python webelement列表在框架切换时变为空
使用Python webelement列表在框架切换时变为空,python,selenium-webdriver,Python,Selenium Webdriver,使用Python和seleniumwebdiver,我从一个HTML页面生成报告 #report name starts with 'std' folderSize = len(driver.find_elements_by_xpath("//*[contains(@id,'std')]")) reportList = driver.find_elements_by_xpath("//*[contains(@id,'std')]") innerIterator = 0 while ( inne
Python
和seleniumwebdiver
,我从一个HTML页面生成报告
#report name starts with 'std'
folderSize = len(driver.find_elements_by_xpath("//*[contains(@id,'std')]"))
reportList = driver.find_elements_by_xpath("//*[contains(@id,'std')]")
innerIterator = 0
while ( innerIterator < folderSize) :
reportList = driver.find_elements_by_xpath("//*[contains(@id,'std')]")
reportName = reportList[innerIterator].text
##### generate report
driver.find_element_by_partial_link_text(reportName).click()
driver.implicitly_wait(3)
driver.switch_to_default_content()
driver.implicitly_wait(3)
reportList = driver.find_elements_by_xpath("//*[contains(@id,'std')]")
##### reportList Becomes NULL here when invoked second time. First Report is successfully generated.
##### Unable to get seocnnd element in the list
print("Generate report")
innerIterator = innerIterator + 1
#报告名称以“std”开头
folderSize=len(驱动程序。通过xpath(“/*[contains(@id,'std')]”)查找元素)
reportList=driver.通过xpath(“/*[contains(@id,'std')]”)查找元素
innerIterator=0
while(innerIterator
reportList
在调用switch\u to\u default\u content()
并随后调用driver之后变为NULL
。通过xpath(“/*[contains(@id,'std')]”)查找元素返回NULL