selenium не вводит символы в поле ввода карты

Lolytmaks

Новичок
Пользователь
Дек 3, 2023
4
0
1
windows 11
python 3.11.4

Package Version
------------------ -----------
attrs 23.1.0
certifi 2023.11.17
cffi 1.16.0
charset-normalizer 3.3.2
h11 0.14.0
idna 3.6
MailTm 0.0.81
outcome 1.3.0.post0
pip 23.3.1
pycparser 2.21
PySocks 1.7.1
requests 2.31.0
selenium 4.15.2
setuptools 68.2.0
sniffio 1.3.0
sortedcontainers 2.4.0
trio 0.23.1
trio-websocket 0.11.1
urllib3 2.1.0
wheel 0.41.2
wsproto 1.2.0

Python:
import re
from mailtm import Email
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
import time

code = None

def listener(message):
    global code
    print("\nSubject: " + message['subject'])
    emailcheck = ("Content: " + message['text'] if message['text'] else message['html'])
    print(emailcheck)
    start_index = emailcheck.find("Вот твой код")
    if start_index != -1:
        code_section = emailcheck[start_index + len("Вот твой код"):].strip()
        end_index = code_section.find(" ")
        code = code_section[:end_index]
    else:
        print("Код не найден.")

tmss = Email()
tmss.register()
tmss.start(listener)
print("\nWaiting for new emails...")

cuda = tmss.address
print(cuda)

option = webdriver.FirefoxOptions()
option.set_preference('dom.webdriver.enabled', False)
option.set_preference('dom.webnotifications.enabled', False)
option.set_preference('media.volume_scale', '0.0')


browser = webdriver.Firefox(options=option)
browser.get('https://www.ivi.ru/login')
browser.implicitly_wait(20)
browser.find_element(By.XPATH, '/html/body/div[13]/div/div[2]/div/div/div[2]/div/div/div/div/form/div[2]/div/div/div/div/input').send_keys(cuda)
browser.find_element(By.XPATH, '/html/body/div[13]/div/div[2]/div/div/div[2]/div/div/div/div/form/div[3]/div/div[1]/button').click()
print('1')
time.sleep(5)
print(code)
print('2')
browser.find_element(By.XPATH, '/html/body/div[13]/div/div[2]/div/div/div[2]/div/div/div/div/div/div[2]/div[2]/div/div/div/label/input').send_keys(code)
print('3')
time.sleep(5)
browser.get('https://www.ivi.ru/cert/promo')
browser.find_element(By.XPATH, '/html/body/div[1]/div[2]/div/div[2]/div/form/div/div/input').send_keys('picodi22')
time.sleep(1)
browser.find_element(By.XPATH, '/html/body/div[1]/div[2]/div/div[2]/div/form/button').click()
time.sleep(1)
browser.find_element(By.XPATH, '/html/body/div[13]/div/div[2]/div/div/div[2]/div/div/div/div/div/div[2]/div/div/div[1]').click()
time.sleep(3)
print('4')
browser.find_element(By.XPATH, '/html/body/form/div[4]/div[4]/div/input').send_keys('12312313')
print('5')

ввод за карту отвечает 57 строка, ошибку не выдает

видео
 

Форум IT Специалистов