Python Forum

Full Version: Unable to select iframe using selenium
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I am trying to automate login process for web page https://hpconnected.com/en/us, login form is an iframe and I am trying to switch to iframe using the id, but it does not work at all. Any help will be appreciated.

from selenium import webdriver
from selenium.webdriver.common.by import By

driver = webdriver.Chrome(executable_path=r"C:\test\chromedriver.exe")
driver.get('https://www.hpconnected.com/us/en')
driver.find_element_by_link_text("Sign In").click()
driver.implicitly_wait(20)
#driver.switch_to_frame(driver.find_element_by_tag_name("iframe"))
iframe = driver.find_element_by_id('webauthPanelIFrame')
driver.switch_to.frame(iframe)
username = driver.find_element_by_name("email")
driver.implicitly_wait(20)
username.send_keys("test@ABC.com")
Please edit your post so that the code is contained in Python code tags. You can find help here.