I'm currently trying out Selenium for Python to do some web automation. I got stuck a the checkout where you have to enter your credit card data. I'm aware that I have to switch to iFrame to locate the input box. But I was never able to switch the frame. I tried it for ID or for example for this:
time.sleep(4)
frame = self.driver.find_element_by_xpath("//iframe[@name= '__privateHeidelpayFrame--heidelpay-holder-iframe-1616489954834']")
self.driver.switch_to.frame(frame)
name_input = self.driver.find_element_by_id("card-holder")
name_input.clear()
name_input.send_keys(credit_card.NAME)
I'm always getting "Unable to locate element : {"method":"xpath","selector":"//iframe[@name= '__privateHeidelpayFrame--heidelpay-holder-iframe-1616489954834']"}".
I added a pic from the Source Code. Source Code from the Webpage
I'm thankful for any advise! Best, Jannic