Bonjour a tous,
J'ai commencé a coder en python avec selenium un bot pour générer des comptes outlook, hors arriver a l’étape du captcha, j'utilise 2captcha qui me renvoie correctement le captcha, mais je ne trouve pas l’élément input ou je dois rentrer le 2 captcha, pouvez-vous m'aider ?
voila mon code :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
import urllib
from selenium import webdriver
 
from webdriver_manager.chrome import ChromeDriverManager
 
driver = webdriver.Chrome(ChromeDriverManager().install())
 
driver.get("https://signup.live.com/signup?lcid=1033&wa=wsignin1.0&rpsnv=13&ct=1596501962&rver=7.0.6737.0&wp=MBI_SSL&wreply=https%3a%2f%2foutlook.live.com%2fowa%2f%3fnlp%3d1%26signup%3d1%26RpsCsrfState%3d4bdefd68-1f14-c815-0b53-9e9b0025d7e9&id=292841&CBCXT=out&lw=1&fl=dob%2cflname%2cwld&cobrandid=90015&lic=1&uaid=582cd9bd788b401993c84ea59ae231ca")
 
 
 
mail1='Bontoqzeugrp'
 
 
 
import time
mail = driver.find_element_by_name('MemberName')
time.sleep(0.5)
mail.send_keys(mail1)
time.sleep(1)
next = driver.find_element_by_id('iSignupAction').click()
 
time.sleep(1)
password = driver.find_element_by_id('PasswordInput')
 
password.send_keys('JIHGE3dfuq@')
time.sleep(0.5)
next = driver.find_element_by_id('iSignupAction').click()
time.sleep(0.5)
name = driver.find_element_by_id('FirstName')
name.send_keys('leo')
time.sleep(0.5)
lastName = driver.find_element_by_id('LastName')
lastName.send_keys('leve')
time.sleep(0.5)
next = driver.find_element_by_id('iSignupAction').click()
time.sleep(0.5)
 
from selenium.webdriver.support.ui import Select
select = Select(driver.find_element_by_id('Country'))
select.select_by_value('DE')
time.sleep(1)
 
from selenium.webdriver.support.ui import Select
day = Select(driver.find_element_by_name('BirthDay'))
day.select_by_value('2')
 
from selenium.webdriver.support.ui import Select
month = Select(driver.find_element_by_name('BirthMonth'))
month.select_by_value('2')
 
from selenium.webdriver.support.ui import Select
year = Select(driver.find_element_by_name('BirthYear'))
year.select_by_value('2002')
 
next = driver.find_element_by_id('iSignupAction').click()
 
time.sleep(1)
 
captcha = driver.find_element_by_id('wlspispHipInstructionContainer')
time.sleep(2)
 
 
src = img.get_attribute('src')
urllib.urlretrieve(src, "captcha.png")
 
 
from twocaptchaapi import TwoCaptchaApi
api = TwoCaptchaApi('API_KEY')
 
with open('captcha.png', 'rb') as captcha_file:
    captcha = api.solve(captcha_file)
 
print(captcha.await_result())
 
captcha.send_keys(captcha.await_result())
 
 
next = driver.find_element_by_id('iSignupAction').click()
Merci de votre aide !