I use fbchat module to listen to my message and use my response as an input for a captcha. I have everything figured out except the last line when I want to call my class variable. Any ideas ?
This is my code :
from fbchat import Client
from fbchat.models import *
import fbchat
from fbchat import log, Client
# Subclass fbchat.Client and override required methods
class EchoBot(Client):
def onMessage(self, author_id, message_object, thread_id, thread_type, **kwargs):
self.markAsDelivered(thread_id, message_object.uid)
self.markAsRead(thread_id)
log.info("{} from {} in {}".format(message_object, thread_id, thread_type.name))
# If you're not the author, echo
if author_id != self.uid:
self.send(message_object, thread_id="id", thread_type=ThreadType.USER)
captchaResponse = str(message_object.text) # This is the text it receive
client = EchoBot("mail", "password")
client.listen()
captchaInput = driver.find_element_by_xpath("//input[@id='captchaResponse']")
captchaImage = driver.find_element_by_id("captchaTag")
captchaImage.screenshot("captcha/captcha.png")
captchaImage = cv2.imread('captcha/captcha.png')
captchaInput.send_keys(captchaResponse, Keys.ENTER) # This is where I'm stuck
EDIT:
So the problem was that I needed to add this line at the end of my function before I could do anything else.
Client.stopListening(self)