Reputation: 1
capturarId = driver.find_element(By.tag_name,"iframe").send_keys('id')
iframe = driver.find_element(by.xpath,"//iframe[@id='"+capturarId+"']")
driver.switch_to.frame(iframe[0])
code and next error type object 'By' has no attribute 'tag_name' please can you help me
Upvotes: 0
Views: 167
Reputation: 792
You have given as iframe[0], iframe is Webelement not array hence you have to write in below way.
capturarId = driver.find_element(By.tag_name,"iframe").send_keys('id')
iframe = driver.find_element_by_xpath("//iframe[@id='"+capturarId+"']")
driver.switch_to.frame(iframe)
Upvotes: 0