Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

This is a one part of my code, here I do click in 'Add a credit or debit card' and switch the frame, for the I will proceed fill the form but have this error:

selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":"//*[@id="pp-QqmNYT-14"]"}

This is my part of code:

self.__driver.find_element(By.LINK_TEXT, 'Add a credit or debit card').click()
self.__driver.switch_to.frame(self.__driver.find_element_by_tag_name('iframe'))
self.__driver.find_element(By.XPATH, '//*[@id="pp-QqmNYT-14"]').send_keys("user admin")
self.__driver.find_element(By.NAME, 'addCreditCardNumber').send_keys(self.cc)

This is the form that i want fill: https://www.amazon.sg/gp/prime/pipeline/membersignup

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
184 views
Welcome To Ask or Share your Answers For Others

1 Answer

See if this works:

self.__driver.switch_to.frame(self.__driver.find_element_by_xpath('.//iframe[contains(@name,'ApxSecureIframe')]'))

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...