def load(self): j = Jaime.getInstance() self.graph_parser.entry_point = 'https://login.yahoo.com/config/login_verify2?&.src=ym' exit_ax = RouteAxis() exit_ax.comment='Accion que tomo para salir del robot' exit_ax.max_crosses = 2 exit_ax.to_url = re.compile(re.escape('https://login.yahoo.com/login?logout=') + '.*') exit_ax.retry_axis = exit_ax.id she = SecuencedHumanEvent() he = MouseHumanEvent.moveMouseTo("li > a",re.compile('.*Sign Out.*')) she.pushHumanEvent(he) he = MouseHumanEvent.clickMouse() she.pushHumanEvent(he) self.graph_parser.navigator.setAxis(exit_ax,she) # ----------------------------------------------- ax = RouteAxis() ax.to_url = 'https://login.yahoo.com/config/login_verify2?&.src=ym' ax.comment='Primer eje, es el que me hace cargar el login' ax.retry_axis = ax.id ax.max_crosses = 1 ax_0_id = ax.id she = SecuencedHumanEvent() she.moveMouseTo("input[id='passwd']") he = MouseHumanEvent.clickMouse() she.pushHumanEvent(he) he = KeyboardHumanEvent.pressTabBackward() she.pushHumanEvent(he) he = KeyboardHumanEvent.pressBackspace() she.pushHumanEvent(he) she.writeText(j.getParam('username','')) he = KeyboardHumanEvent.pressTabForward() she.pushHumanEvent(he) she.writeText(j.getParam('password','')) she.moveMouseTo("button[id='.save']") he = MouseHumanEvent.clickMouse() she.pushHumanEvent(he) self.graph_parser.navigator.setAxis(ax,she) # ----------------------------------------------- ax_1 = RouteAxis() ax_1_id = ax_1.id ax_2 = RouteAxis() ax_2_id = ax_2.id ax_3 = RouteAxis() ax_3_id = ax_3.id ax_4 = RouteAxis() ax_4_id = ax_4.id ax_5 = RouteAxis() ax_5_id = ax_5.id ax_6 = RouteAxis() ax_6_id = ax_6.id # ---------------------------------------------- ax_1.comment='Acabo de loguearme. Busco el recurso en el inbox' ax_1.to_url = re.compile(re.escape('http://us.') + '.*' + re.escape('.mail.yahoo.com/mc/welcome?') + '.*') ax_1.previous_axis.append([ax_0_id]) she = SecuencedHumanEvent() she.moveMouseTo("input[id='mailsearchtop']") he = MouseHumanEvent.clickMouse() she.pushHumanEvent(he) self.graph_parser.navigator.setAxis(ax_1,she) self.graph_parser.navigator.collectData(ax_1_id,'printData',['User %s logged in' % j.getParam('username','')]) #-------------------------------------------------------------- ax_3.comment='Estoy viendo un resultado de busqueda sin resultados' ax_3.previous_axis.append([ax_6_id]) ax_3.previous_axis.append([ax_4_id]) ax_3.max_crosses = 1 ax_3.css_selector_condition = "table[id='datatable'] a[href^='/mc/showMessage']" ax_3.not_css_selector = True # me voy para la busqueda avanzada she = SecuencedHumanEvent() she.moveMouseTo("input[id='msqtop']") he = MouseHumanEvent.clickMouse() she.pushHumanEvent(he) he = KeyboardHumanEvent.pressTabForward() she.pushHumanEvent(he) he = KeyboardHumanEvent.pressTabBackward() she.pushHumanEvent(he) he = KeyboardHumanEvent.pressBackspace() she.pushHumanEvent(he) she.moveMouseTo("input[id='mailsearchtop']") he = MouseHumanEvent.clickMouse() she.pushHumanEvent(he) self.graph_parser.navigator.setAxis(ax_3,she) #-------------------------------------------------------------- ax_2.comment='Estoy viendo un resultado de busqueda con resultados' ax_2.previous_axis.append([ax_6_id]) ax_2.previous_axis.append([ax_4_id]) ax_2.css_selector_condition = "table[id='datatable'] a[href^='/mc/showMessage']" she = SecuencedHumanEvent() she.moveMouseTo("table[id='datatable'] a[href^='/mc/showMessage']") he = MouseHumanEvent.clickMouse() she.pushHumanEvent(he) self.graph_parser.navigator.setAxis(ax_2,she) #-------------------------------------------------------------- ax_4.comment='Estoy en el formulario de busqueda avanzada, busco en el spam' ax_4.to_url = re.compile(re.escape('http://us.') + '.*' + re.escape('.mail.yahoo.com/mc/welcome?') + '.*') ax_4.previous_axis.append([ax_3_id]) she = SecuencedHumanEvent() she.moveMouseTo("input[name='from']") he = MouseHumanEvent.clickMouse() she.pushHumanEvent(he) she.writeText(j.getParam('resource','')) she.moveMouseTo("input[id='fol-0']") he = MouseHumanEvent.clickMouse() she.pushHumanEvent(he) she.moveMouseTo("input[id='fol-1']") he = MouseHumanEvent.clickMouse() she.pushHumanEvent(he) she.moveMouseTo("input[id='fol-2']") he = MouseHumanEvent.clickMouse() she.pushHumanEvent(he) she.moveMouseTo("input[id='global_check_mail_bottom']") he = MouseHumanEvent.clickMouse() she.pushHumanEvent(he) self.graph_parser.navigator.setAxis(ax_4,she) #-------------------------------------------------------------- ax_5.comment='Estoy viendo un mail que encontre en el spam o el inbox' ax_5.previous_axis.append([ax_2_id]) she = SecuencedHumanEvent() she.moveMouseTo("input[name='top_delete']") he = MouseHumanEvent.clickMouse() she.pushHumanEvent(he) self.graph_parser.navigator.setAxis(ax_5,she) #-------------------------------------------------------------- ax_6.comment='Entre a la busqueda avanzada para buscar en inbox' ax_6.previous_axis.append([ax_1_id]) she = SecuencedHumanEvent() she.moveMouseTo("input[name='from']") he = MouseHumanEvent.clickMouse() she.pushHumanEvent(he) she.writeText(j.getParam('resource','')) she.moveMouseTo("input[id='fol-1']") he = MouseHumanEvent.clickMouse() she.pushHumanEvent(he) she.moveMouseTo("input[id='fol-2']") he = MouseHumanEvent.clickMouse() she.pushHumanEvent(he) she.moveMouseTo("input[id='fol-3']") he = MouseHumanEvent.clickMouse() she.pushHumanEvent(he) she.moveMouseTo("input[id='global_check_mail_bottom']") he = MouseHumanEvent.clickMouse() she.pushHumanEvent(he) he = SystemExternEvent("sleep", [ '15']) she.pushHumanEvent(he) she.moveMouseTo("table[id='datatable'] a[href^='/mc/showMessage']") he = MouseHumanEvent.clickMouse() she.pushHumanEvent(he) self.graph_parser.navigator.setAxis(ax_6,she)
def load(self): j = Jaime.getInstance() self.graph_parser.entry_point = 'https://login.yahoo.com/config/login_verify2?&.src=ym' exit_ax = RouteAxis() exit_ax.comment='Accion que tomo para salir del robot' exit_ax.max_crosses = 2 exit_ax.to_url = re.compile(re.escape('https://login.yahoo.com/login?logout=') + '.*') exit_ax.retry_axis = exit_ax.id she = SecuencedHumanEvent() he = MouseHumanEvent.moveMouseTo("li > a",re.compile('.*Sign Out.*')) she.pushHumanEvent(he) he = MouseHumanEvent.clickMouse() she.pushHumanEvent(he) self.graph_parser.navigator.setAxis(exit_ax,she) # ----------------------------------------------- ax = RouteAxis() ax.to_url = 'https://login.yahoo.com/config/login_verify2?&.src=ym' ax.comment='Primer eje, es el que me hace cargar el login' ax.retry_axis = ax.id ax.max_crosses = 1 ax.exit_point = exit_ax.id login_ax_id = ax.id she = SecuencedHumanEvent() she.moveMouseTo("input[id='passwd']") he = MouseHumanEvent.clickMouse() she.pushHumanEvent(he) he = KeyboardHumanEvent.pressTabBackward() she.pushHumanEvent(he) he = KeyboardHumanEvent.pressBackspace() she.pushHumanEvent(he) she.writeText(j.getParam('username','')) he = KeyboardHumanEvent.pressTabForward() she.pushHumanEvent(he) she.writeText(j.getParam('password','')) she.moveMouseTo("button[id='.save']") he = MouseHumanEvent.clickMouse() she.pushHumanEvent(he) self.graph_parser.navigator.setAxis(ax,she) # ----------------------------------------------- ax = RouteAxis() ax.comment='Acabo de loguearme, estoy mi mail' ax.to_url = re.compile(re.escape('http://us.') + '.*' + re.escape('.mail.yahoo.com/mc/welcome?') + '.*') ax.previous_axis.append([login_ax_id]) ax.max_crosses = 2 ax.retry_axis = ax.id ax.exit_point = exit_ax.id ax_home_mail_id = ax.id she = SecuencedHumanEvent() she.moveMouseTo("li[id='bulk']") he = MouseHumanEvent.clickMouse() she.pushHumanEvent(he) self.graph_parser.navigator.setAxis(ax,she) self.graph_parser.navigator.collectData(ax.id,'printData',['User %s logged in' % j.getParam('username','')]) self.graph_parser.navigator.collectData(ax.id,'spamCount',[]) self.graph_parser.navigator.collectData(ax.id,'spamUnreadCount',[]) self.graph_parser.navigator.collectData(ax.id,'inboxCount',[]) self.graph_parser.navigator.collectData(ax.id,'inboxUnreadCount',[]) # ----------------------------------------------- ax_bulk = RouteAxis() ax_bulk.comment='Entre al bulk ahora tengo que agarrar los mail no leidos, hago click en unread' ax_bulk.css_selector_condition = "li[id='bulk'][class~='selected']" ax_bulk.to_url = re.compile('.*welcome\?.*_pg=showFolder.*fid=.*Bulk') ax_bulk.previous_axis.append([ax_home_mail_id]) ax_bulk.retry_axis = ax_home_mail_id she = SecuencedHumanEvent() he = MouseHumanEvent.moveMouseTo("li > a",re.compile('\s*Unread\s*')) she.pushHumanEvent(he) he = MouseHumanEvent.clickMouse() she.pushHumanEvent(he) self.graph_parser.navigator.setAxis(ax_bulk,she) # ----------------------------------------------- #necesito crear este axis aca para tener el id click_mail_ax = RouteAxis() ax_bulk_unread = RouteAxis() ax_bulk_unread.comment='Entre al bulk con unread seleccionado' ax_bulk_unread.css_selector_condition = "li[id='bulk'][class~='selected']" ax_bulk_unread.to_url = re.compile('.*welcome\?.*_pg=showFolder.*fid=.*Bulk') ax_bulk_unread.max_crosses = 25 ax_bulk_unread.retry_axis = ax_home_mail_id ax_bulk_unread.exit_point = exit_ax.id ax_bulk_unread.previous_axis.append([ax_bulk.id]) ax_bulk_unread.previous_axis.append([click_mail_ax.id]) she = SecuencedHumanEvent() she.moveMouseTo("tr[class='msgnew'] a[href^='showMessage']") he = MouseHumanEvent.clickMouse() she.pushHumanEvent(he) self.graph_parser.navigator.setAxis(ax_bulk_unread,she) # ----------------------------------------------- show_img_ax = RouteAxis() show_img_ax.previous_axis.append([ax_bulk_unread.id]) show_img_ax.css_selector_condition = "b[id='message_view_showimg']" show_img_ax.comment='Entre a un mail no leido que no tiene las imagenes desplegadas, las desplego' show_img_ax.retry_axis = ax_home_mail_id she = SecuencedHumanEvent() he = MouseHumanEvent.moveMouseTo("a",re.compile('.*Show\sImages.*')) she.pushHumanEvent(he) he = MouseHumanEvent.clickMouse() she.pushHumanEvent(he) self.graph_parser.navigator.setAxis(show_img_ax,she) # ----------------------------------------------- click_mail_ax.previous_axis.append([ax_bulk_unread.id]) click_mail_ax.previous_axis.append([show_img_ax.id]) click_mail_ax.css_selector_condition = "b[id='message_view_showimg']" click_mail_ax.not_css_selector = True click_mail_ax.comment='Entro a un mail que tiene las imagenes desplegadas, viniendo del nodo bulk o habiendo clickeado desplegar imagenes' click_mail_ax.retry_axis = ax_home_mail_id she = SecuencedHumanEvent() he = MouseHumanEvent.moveMouseTo("a",None,None, {'href':re.compile('.*\/g\/c\?E=.*')}) she.pushHumanEvent(he) he = MouseHumanEvent.clickMouseNewTab() she.pushHumanEvent(he) he = MouseHumanEvent.moveMouseTo("input[value='Not Spam']") she.pushHumanEvent(he) he = MouseHumanEvent.clickMouse() she.pushHumanEvent(he) self.graph_parser.navigator.setAxis(click_mail_ax,she) self.graph_parser.navigator.collectData(click_mail_ax.id,'getSubjectFromMail',[]) self.graph_parser.navigator.collectData(click_mail_ax.id,'getFromDomainFromMail',[]) self.graph_parser.navigator.collectData(click_mail_ax.id,'getLinksFromMail',[])