can you update the browser selector elements THEN WE'RE GOLDEN
DevTools listening on ws://127.0.0.1:53989/devtools/browser/2bff3963-5f92-4340-9670-71acebba18f8
[3108:11824:0527/151204.206:ERROR:device_event_log_impl.cc(214)] [15:12:04.207] Bluetooth: bluetooth_adapter_winrt.cc:1074 Getting Default Adapter failed.
Traceback (most recent call last):
File "C:\Users\Paul\Downloads\Instagram DM Test\DMer.py", line 90, in
schedule.run_pending()
File "C:\Users\Paul\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\schedule_init_.py", line 780, in run_pending
default_scheduler.run_pending()
File "C:\Users\Paul\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\schedule_init_.py", line 100, in run_pending
self.run_job(job)
File "C:\Users\Paul\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\schedule_init.py", line 172, in run_job
ret = job.run()
File "C:\Users\Paul\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\schedule_init.py", line 661, in run
ret = self.job_func()
File "C:\Users\Paul\Downloads\Instagram DM Test\DMer.py", line 66, in dmer
send_msg(usrnamee)
File "C:\Users\Paul\Downloads\Instagram DM Test\DMer.py", line 42, in send_msg
chk_mrk = browser.find_element_by_class_name('dCJp8')
File "C:\Users\Paul\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\selenium\webdriver\remote\webdriver.py", line 564, in find_element_by_class_name
return self.find_element(by=By.CLASS_NAME, value=name)
File "C:\Users\Paul\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\selenium\webdriver\remote\webdriver.py", line 976, in find_element
return self.execute(Command.FIND_ELEMENT, {
File "C:\Users\Paul\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "C:\Users\Paul\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"css selector","selector":".dCJp8"}
(Session info: chrome=102.0.5005.63)
THE CODE REFERS TO THESE OLD PATH ELEMENTS:
def send_msg(usrnames):
browser.get('https://www.instagram.com/direct/new/')
time.sleep(5)
to_btn = browser.find_element_by_name('queryBox')
to_btn.send_keys(usrnames)
time.sleep(8)
chk_mrk = browser.find_element_by_class_name('dCJp8')
chk_mrk.click()
time.sleep(3)
nxt_btn = browser.find_element_by_xpath('//div[@class="mXkkY KDuQp"]')
nxt_btn.click()
time.sleep(6)
txt_box = browser.find_element_by_tag_name('textarea')
txt_box.send_keys(f" @{usrnames} my custom message here @username ") # Customize your message
time.sleep(2)
snd_btn = browser.find_elements_by_css_selector('.sqdOP.yWX7d.y3zKF')
snd_btnn = snd_btn[len(snd_btn)-1]
snd_btnn.click()
time.sleep(4)
count = 0
try:
for usrnamee in usrnames:
send_msg(usrnamee)
count += 1
except TypeError:
print('Failed!')
browser.quit()
print(f'''
Successfully Sent {count} Massages
''')
x += 1
timee = "15:12" # Specific Time When The message will be send
try:
schedule.every().day.at(timee).do(dmer)
except TypeError:
pass
try:
while True and x != 1:
schedule.run_pending()
time.sleep(1)
except UnboundLocalError:
pass