Closed KeparYTbcc closed 2 years ago
Hi, what is your issue?
Hi, what is your issue?
Traceback (most recent call last): File "F:\dev\main.py", line 57, in <module> hcaptcha = hCaptcha() # Init hCaptcha class. File "F:\dev\hcaptcha.py", line 31, in __init__ self.driver = self.webdriver() # Start new webdriver. File "F:\dev\hcaptcha.py", line 43, in webdriver driver = webdriver.Chrome(self.webdriver_path, options=options) File "C:\Users\my-pc2\AppData\Local\Programs\Python\Python310\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 69, in __init__ super(WebDriver, self).__init__(DesiredCapabilities.CHROME['browserName'], "goog", File "C:\Users\my-pc2\AppData\Local\Programs\Python\Python310\lib\site-packages\selenium\webdriver\chromium\webdriver.py", line 93, in __init__ RemoteWebDriver.__init__( File "C:\Users\my-pc2\AppData\Local\Programs\Python\Python310\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 248, in __init__ self.start_session(capabilities, browser_profile) File "C:\Users\my-pc2\AppData\Local\Programs\Python\Python310\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 339, in start_session response = self.execute(Command.NEW_SESSION, parameters) File "C:\Users\my-pc2\AppData\Local\Programs\Python\Python310\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 400, in execute self.error_handler.check_response(response) File "C:\Users\my-pc2\AppData\Local\Programs\Python\Python310\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 236, in check_response raise exception_class(message, screen, stacktrace) selenium.common.exceptions.SessionNotCreatedException: Message: Unable to find a matching set of capabilities
F:\dev>
@maximedrn
Remove everything in the webdriver method and replace with: options = Options() profile = webdriver.FirefoxProfile() profile.set_preference('intl.accept_languages', 'en-GB') driver = webdriver.Firefox(options=options,firefox_profile=profile) path = os.getcwd() extension_path = path + "\cap.xpi" driver.install_addon(extension_path) driver.get("about:support") return driver
You are trying to start a geckodriver while the hCaptcha class tries to start a chromedriver.
If you want to use a geckodriver, you must change the webdriver method.
ohh, but i need to set the language absolutly beacouse my firefox is always putting in french
@maximedrn
The hCaptcha solver from engageub only supports English.
ye but the browser bot version is defaultly set himself in french,
that why i added: profile.set_preference('intl.accept_languages', 'en-GB')
Yeah, you're right. Have you try to edit the webdriver method? You want to use a geckodriver, right?
ye
You just need to edit this part of code and it will work :) Just remember that you have to change the geckodriver language to english and to have the Tampermonkey XPI file added to your code.
but i want to edit and put the right language for everyone else wich download the software that i made , in case they download an other language driver..?
No, default language is English for all drivers. It's just your Firefox that has set the default language to French. People that will use your script will have the geckodriver in English.
still, i want to be sure, in case
Traceback (most recent call last):
File "F:\dev\main.py", line 45, in <module>
hcaptcha = hCaptcha() # Init hCaptcha class.
File "F:\dev\hcaptcha.py", line 31, in __init__
self.driver = self.webdriver() # Start new webdriver.
File "F:\dev\hcaptcha.py", line 43, in webdriver
driver = webdriver.Chrome(self.webdriver_path, options=options)
File "C:\Users\my-pc2\AppData\Local\Programs\Python\Python310\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 69, in __init__
super(WebDriver, self).__init__(DesiredCapabilities.CHROME['browserName'], "goog",
File "C:\Users\my-pc2\AppData\Local\Programs\Python\Python310\lib\site-packages\selenium\webdriver\chromium\webdriver.py", line 93, in __init__
RemoteWebDriver.__init__(
File "C:\Users\my-pc2\AppData\Local\Programs\Python\Python310\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 248, in __init__
self.start_session(capabilities, browser_profile)
File "C:\Users\my-pc2\AppData\Local\Programs\Python\Python310\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 339, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
File "C:\Users\my-pc2\AppData\Local\Programs\Python\Python310\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 400, in execute
self.error_handler.check_response(response)
File "C:\Users\my-pc2\AppData\Local\Programs\Python\Python310\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 236, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.SessionNotCreatedException: Message: Unable to find a matching set of capabilities
F:\dev>
import selenium
from selenium import *
from selenium import webdriver
from selenium.webdriver.common.by import By
import random
import sys
from time import sleep
import os
from selenium.webdriver.common.keys import Keys
import getpass
from selenium.webdriver.common.action_chains import ActionChains
from hcaptcha import hCaptcha
from selenium.webdriver.firefox.options import Options
os.system('title Kolhax TT acc generator PRO')
class bcolors:
HEADER = '\033[95m'
OKBLUE = '\033[94m'
OKCYAN = '\033[96m'
OKGREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033[0m'
BOLD = '\033[1m'
UNDERLINE = '\033[4m'
def clear():
os.system('cls')
clear()
print('''
Hi, beafore starting...
you would need to have Firefox installed,
** This service need to manually phone
** verify the generate accounts
''')
os.system('pause')
clear()
if __name__ == '__main__':
hcaptcha = hCaptcha() # Init hCaptcha class.
hcaptcha.download_userscript() # Download the hCaptcha solver userscript.
clear()
print(f'{bcolors.WARNING}[{bcolors.ENDC}+{bcolors.WARNING}]{bcolors.ENDC} Hcaptcha Accessibility Gained!')
sleep(3)
clear()
name = input(f'{bcolors.WARNING}[{bcolors.ENDC}+{bcolors.WARNING}]{bcolors.ENDC} Base name: ')
passw = input(f'{bcolors.WARNING}[{bcolors.ENDC}+{bcolors.WARNING}]{bcolors.ENDC} Base Password: ')
clear()
print(f'{bcolors.WARNING}[{bcolors.ENDC}+{bcolors.WARNING}]{bcolors.ENDC} Gen As been Started!')
print(f'{bcolors.WARNING}[{bcolors.ENDC}+{bcolors.WARNING}]{bcolors.ENDC} To avoid Rate Limiting, we implemented a 30s cooldown!')
sleep(3)
clear()
while True:
driver.get('https://maximedrn.github.io/hcaptcha-solver-python-selenium/')
I remaked the code for firefox I tested and worked for me, first download tempearmonkey extension for firefox and save this in assets directory, you can download in below https://addons.cdn.mozilla.net/user-media/addons/683490/tampermonkey-4.13.6136-an+fx.xpi
and run:
"""
@author: Maxime.
Github: https://github.com/maximedrn
Demonstration website: https://maximedrn.github.io/hcaptcha-test/
Version: 1.0
"""
# Colorama module: pip install colorama
from colorama import init, Fore, Style
# provide an webdriver manager to install driver automatically
from webdriver_manager.firefox import GeckoDriverManager
# Selenium module imports: pip install selenium
from selenium import webdriver
from selenium.common.exceptions import TimeoutException as TE
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.support.ui import WebDriverWait as WDW
from selenium.webdriver.common.by import By
# Python default import.
import sys
import os
"""Colorama module constants."""
init(convert=True) # Init colorama module.
red = Fore.RED # Red color.
green = Fore.GREEN # Green color.
yellow = Fore.YELLOW # Yellow color.
reset = Style.RESET_ALL # Reset color attribute.
class hCaptcha:
"""Main class of the hCaptcha solver."""
def __init__(self):
self.extension_path = os.path.join(os.getcwd(), 'assets', 'tampermonkey-4.13.6136-an+fx.xpi')
self.s = Service(GeckoDriverManager().install())
self.driver = self.webdriver()
self.driver.install_addon(self.extension_path)
def webdriver(self):
"""Start webdriver and return state of it."""
options = webdriver.FirefoxOptions() # Configure options for Chrome.
options.set_preference('intl.accept_languages', 'en-US, en')
# options.add_argument("headless") # Headless ChromeDriver.
options.add_argument('log-level=3') # No logs is printed.
options.add_argument('--mute-audio') # Audio is muted.
options.add_argument("--enable-webgl-draft-extensions")
options.add_argument("--ignore-gpu-blocklist")
driver = webdriver.Firefox(service=self.s, options=options)
driver.maximize_window() # Maximize window to reach all elements.
return driver
def element_clickable(self, element: str) -> None:
"""Click on element if it's clickable using Selenium."""
WDW(self.driver, 5).until(EC.element_to_be_clickable(
(By.XPATH, element))).click()
def element_clickable_name(self, element: str) -> None:
"""Click on element if it's clickable using Selenium."""
WDW(self.driver, 5).until(EC.element_to_be_clickable(
(By.NAME, element))).click()
def element_visible(self, element: str):
"""Check if element is visible using Selenium."""
return WDW(self.driver, 20).until(EC.visibility_of_element_located(
(By.XPATH, element)))
def window_handles(self, window_number: int) -> None:
"""Check for window handles and wait until a specific tab is opened."""
WDW(self.driver, 30).until(lambda _: len(
self.driver.window_handles) == window_number + 1)
# Switch to asked tab.
self.driver.switch_to.window(self.driver.window_handles[window_number])
def download_userscript(self) -> None:
"""Download the hCaptcha solver userscript."""
try:
print('Installing the hCaptcha solver userscript.', end=' ')
self.window_handles(1) # Wait that Tampermonkey tab loads.
self.driver.get('https://greasyfork.org/en/scripts/425854-hcaptcha'
'-solver-automatically-solves-hcaptcha-in-browser')
# Click on "Install" Greasy Fork button.
self.element_clickable('//*[@id="install-area"]/a[1]')
# Click on "Install" Tampermonkey button.
self.window_handles(2) # Switch on Tampermonkey install tab.
self.element_clickable_name("Install")
self.window_handles(1) # Switch to Greasy Fork tab.
self.driver.close() # Close this tab.
self.window_handles(0) # Switch to main tab.
print(f'{green}Installed.{reset}')
except TE:
sys.exit(f'{red}Failed.{reset}')
def demonstration(self) -> None:
"""Demonstration of the hCaptcha solver."""
try:
print('Solving hCaptcha.', end=' ')
# hCaptcha solver URL test.
self.driver.get(
'https://maximedrn.github.io/hcaptcha-solver-python-selenium/')
# Check if lenght of "data-hcaptcha-response" attribute is not
# null. If it's not null, hCaptcha is solved.
WDW(self.driver, 600).until(lambda _: len(self.element_visible(
'//div[@class="h-captcha"]/iframe').get_attribute(
'data-hcaptcha-response')) > 0)
print(f'{green}Solved.{reset}')
except TE:
print(f'{red}Failed.{reset}')
def cls() -> None:
"""Clear console function."""
# Clear console for Windows using 'cls' and Linux & Mac using 'clear'.
os.system('cls' if os.name == 'nt' else 'clear')
if __name__ == '__main__':
cls() # Clear console.
print(f'{green}Made by Maxime. '
f'\n@Github: https://github.com/maximedrn{reset}')
hcaptcha = hCaptcha() # Init hCaptcha class.
hcaptcha.download_userscript() # Download the hCaptcha solver userscript.
hcaptcha.demonstration() # Demonstrate the hCaptcha solver.
Added in version 1.2.0.
each time i do it with firefox: