0
votes

Je peux cliquer sur l'élément mais ne peut pas envoyer de l'envoi (Python sélénium)

Je peux cliquer sur l'élément mais ne peut pas envoyer de l'envoi (python sélénium) dans ce formulaire de paiement:

<input class="js-iframe-input input-field" id="encryptedExpiryDate" type="tel" maxlength="5" autocomplete="cc-exp" placeholder="MM/AA" aria-label="Default aria expiry date label" aria-invalid="true" aria-required="true" aria-describedby="ariaErrorField" data-type="gsf" style="display: block;">


0 commentaires

3 Réponses :


0
votes

Essayez de prendre de l'aide du code ci-dessous -

# Import
from selenium.webdriver import ActionChains

action = ActionChains(driver)

Elem_Send_Key = card_exiry.until(EC.presence_of_element_located((By.XPATH, "//input[@id='encryptedCardNumber']")))

action.move_to_element(Elem_Send_Key).click().send_keys("XYZ").perform()


2 commentaires

Essayez uniquement action.move_to_element (elem_send_key) .Cliquez sur (). Send_Keys ("xyz") ou action.move_to_element (elem_send_key) .Send_keys ("xyz").


Pour le numéro de carte, ce code fonctionne bien: webdiverwait (self.driver, 20) .Until (EC.frame_to_be_available_and_switch_to_it (((by.xpat h, '// iframe [1]'))) webDriverwait (Self.Driver, 20 ). JUNTIL (EC.Element_To_be_Clickable (((by.xpath, "//Input[@id='Cenpryptedcardnumber']"))).send_keys('403550100 0000008 ') Mais Date d'expiration du sapin et numéro CVV ne fonctionne pas, j'ai Changer Endex pour 2 et 3 mais ne fonctionne pas dans Katalon, il a [Selectframe | Relative = Parent | ]] Swich entre le cadre mais je ne peux pas trouver une solution pour ça



0
votes

Tout d'abord, dans le code HTML, votre élément est ID cryptéexpiptydate code>, mais dans le localisateur, vous définissez // entrée [@ ID = 'Cryptedcardnumber'] code>

second, Essayez de changer .presence_of_element_located code> pour être .element_to_be_clickable code> p>

Essayez ceci: p>

card_exiry.until(EC.element_to_be_clickable((By.XPATH, "//input[@id='encryptedExpiryDate']"))).send_keys('3023')


0 commentaires

0
votes

Endoved par ce code:

    def type_order_credit_card1_information(self):
    # Enter the credit card number
    IwebElement_Element = self.driver.find_element_by_xpath('//iframe[1]')
    self.driver.switch_to.frame(IwebElement_Element)
    test = WebDriverWait(self.driver, 20).until(
        EC.element_to_be_clickable((By.XPATH, "//input[@id='encryptedCardNumber']")))
    test.send_keys(credit_card1_number)
    self.driver.switch_to.parent_frame() # To switch to the parent frame
    # Enter the credit card expiry date
    IwebElement_Element2 = self.driver.find_element_by_xpath('//*[@id="adyen-card-container"]/div/div/div[2]/div/div[2]/div[1]/label/span[2]/span/iframe')
    self.driver.switch_to.frame(IwebElement_Element2)
    test = WebDriverWait(self.driver, 20).until(
        EC.element_to_be_clickable((By.XPATH, "//input[@id='encryptedExpiryDate']")))
    test.send_keys(credit_card1_expiry_date)
    self.driver.switch_to.parent_frame()  # To switch to the parent frame
    # Enter the credit card cvv security number
    IwebElement_Element3 = self.driver.find_element_by_xpath(
        '//*[@id="adyen-card-container"]/div/div/div[2]/div/div[2]/div[2]/label/span[2]/span/iframe')
    self.driver.switch_to.frame(IwebElement_Element3)
    test = WebDriverWait(self.driver, 20).until(
        EC.element_to_be_clickable((By.XPATH, "//input[@id='encryptedSecurityCode']")))
    test.send_keys(credit_card1_cvv_number)
    self.driver.switch_to.parent_frame()  # To switch to the parent frame


0 commentaires