Beispiel #1
0
import sys
import time

from chatbot import ChatBot


if __name__ == "__main__":

    # create the bot
    qchatbot = ChatBot(False, 'http://real-time-chat.appspot.com/', True)
    
    # navigate to the login page
    qchatbot.visit(qchatbot.site)
    
    # login to the site
    qchatbot.login('aaron', '1234')
    
    # select the friend to talk with
    assert qchatbot.select_friend('alice'), "Your friend is offline"
    
    # quotes to respond with
    quotes, index = [], 0
    with open('quotes.txt', 'rb') as f:
        for line in f:
            quotes.append(line)
    
    # record the nubmer of messages
    num_messages = len(qchatbot.get_messages())
    
    while True:
        # indicates a message was recieved, respond
Beispiel #2
0
    
    if not sys.argv[3]:
      print "Need password of the user to login"
      sys.exit()
      
      
    site = sys.argv[1]
    # create a chatbot instance
    cb1 = ChatBot(True, site, False)
  
      
    # navigate to the chat site
    cb1.visit(sys.argv[1] + '/login')

    # enter the site
    cb1.login(sys.argv[2], sys.argv[3])

    # add a non-existent friend
 #   cb1.add_friend('bob1')

    # select the current freinds list
    friends = cb1.get_friends_list()
    while not friends:
      friends = cb1.get_friends_list()
    aFriend = friends[0]
    # iterate through the friends list
  
    # select friend chat window
    cb1.select_friend(aFriend)
    # send a message
    while True:
Beispiel #3
0
import time

from chatbot import ChatBot


if __name__ == '__main__':

    # create a chatbot instance
    site = 'localhost:8080'
    cb1 = ChatBot(False, site)

    # navigate to the chat site
    cb1.visit(site)

    # enter the site
    cb1.login('asdf', 'asdf')

    # add a non-existent friend
    cb1.add_friend('bob1')

    # select the current freinds list
    friends = cb1.get_friends_list()

    # iterate through the friends list
    for friend in friends:
        # select friend chat window
        cb1.select_friend(friend)
        # send a message
        for i in range(0,5):
            cb1.send_message('qwertyuiopasadfghjklzxcvbnm')
            time.sleep(.5)