Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix NoSuchElementException and undetected_chromedriver #28

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from colorama import Fore, init, Style
import ctypes, platform, os, time
import selenium, requests, webbrowser
from seleniunbase import Driver

except ImportError:
input("You do not have all of the modules required installed.")
Expand All @@ -19,7 +20,7 @@
class zefoy:

def __init__(self):
self.driver = uc.Chrome()
self.driver = Driver(uc=True)
self.captcha_box = '/html/body/div[5]/div[2]/form/div/div'
self.clear = "clear"

Expand Down Expand Up @@ -121,9 +122,15 @@ def send_bot(self, search_button, main_xpath, vid_info, div):
time.sleep(3)

send_button = f'/html/body/div[{div}]/div/div/div[1]/div/form/button'
self.driver.find_element('xpath', send_button).click()
self.sent += 1
print(self._print(f"Sent {self.sent} times."))
try:

self.driver.find_element('xpath', send_button).click()
self.sent += 1
print(self._print(f"Sent {self.sent} times."))

except selenium.common.exceptions.NoSuchElementException:
self.send_bot(search_button, main_xpath, vid_info, div) # recursively send bot until Element is found; passing the exception stops the bot


time.sleep(4)
self.send_bot(search_button, main_xpath, vid_info, div)
Expand Down