Home > database >  Filling Out Credit Card IFrame
Filling Out Credit Card IFrame

Time:09-16

Trying to buy 2 security cameras from Ubiquiti. I cannot, for the life of me, figure out how to navigate to the iframe. I've been trying to do this for probably 4-5 hours total now.

Right now, I have this: (wd is webdriver, chrome)

wd.switch_to.frame(wd.find_element("title", 'card-fields-iframe'))

credit_card_number = wd.find_element("xpath" , '//*[@id="number"]')

type(credit_card_number)

credit_card_number.send_keys("1234123412341234")

I can't use an ID to hit the iframe because it changes every time you access the page, as does the name. The only constant I've seen is title but idk if that works. Any help would be apprecaited.

enter image description here

CodePudding user response:

Try to create an XPath from the parent 'div' like this:

'.//div[@class='field__input field__input--iframe-container']/iframe'

If you get the unique path for the above XPath, then you can use this XPath.

CodePudding user response:

@Roo try the following:

instead of:

wd.switch_to.frame(wd.find_element("title", 'card-fields-iframe'))

try:

wd.switch_to.frame(wd.find_element("class_name", 'card-fields-iframe'))

Seems from your screenshot, the class name of iframe element is 'card-fields-iframe' and not title.

  • Related