d i f f   - - g i t   a / c h u s c r a p e r / c o r e / c o n n e c t i o n . p y   b / c h u s c r a p e r / c o r e / c o n n e c t i o n . p y 
 
 i n d e x   d 7 8 1 d 6 5 . . 0 0 7 f c 0 7   1 0 0 6 4 4 
 
 - - -   a / c h u s c r a p e r / c o r e / c o n n e c t i o n . p y 
 
 + + +   b / c h u s c r a p e r / c o r e / c o n n e c t i o n . p y 
 
 @ @   - 8 0 , 9   + 8 0 , 9   @ @   c l a s s   C o n n e c t i o n : 
 
                   s e l f . _ _ d i c t _ _ . u p d a t e ( * * k w a r g s ) 
 
   
 
           @ p r o p e r t y 
 
 -         d e f   t a r g e t _ i d ( s e l f )   - >   O p t i o n a l [ s t r ] : 
 
 +         d e f   t a r g e t _ i d ( s e l f )   - >   O p t i o n a l [ c d p . t a r g e t . T a r g e t I D ] : 
 
                   i f   s e l f . t a r g e t   a n d   h a s a t t r ( s e l f . t a r g e t ,   ' t a r g e t _ i d ' ) : 
 
 -                         r e t u r n   s t r ( s e l f . t a r g e t . t a r g e t _ i d ) 
 
 +                         r e t u r n   s e l f . t a r g e t . t a r g e t _ i d 
 
                   r e t u r n   N o n e 
 
   
 
           @ p r o p e r t y 
 
 d i f f   - - g i t   a / c h u s c r a p e r / c o r e / e l e m e n t s / i n t e r a c t i o n . p y   b / c h u s c r a p e r / c o r e / e l e m e n t s / i n t e r a c t i o n . p y 
 
 i n d e x   c c c 3 0 b f . . 0 0 f a e 4 a   1 0 0 6 4 4 
 
 - - -   a / c h u s c r a p e r / c o r e / e l e m e n t s / i n t e r a c t i o n . p y 
 
 + + +   b / c h u s c r a p e r / c o r e / e l e m e n t s / i n t e r a c t i o n . p y 
 
 @ @   - 3 6 9 , 3 2   + 3 6 9 , 4 2   @ @   c l a s s   E l e m e n t I n t e r a c t i o n M i x i n ( E l e m e n t M i x i n ) : 
 
                   r e t u r n _ b y _ v a l u e :   b o o l   =   T r u e , 
 
                   * , 
 
                   a w a i t _ p r o m i s e :   b o o l   =   F a l s e , 
 
 +                 r e t r y :   b o o l   =   T r u e , 
 
           )   - >   t y p i n g . A n y : 
 
                   i f   n o t   s e l f . r e m o t e _ o b j e c t : 
 
                             s e t a t t r ( s e l f ,   ' _ r e m o t e _ o b j e c t ' ,   a w a i t   s e l f . t a b . s e n d ( 
 
                                   c d p . d o m . r e s o l v e _ n o d e ( b a c k e n d _ n o d e _ i d = s e l f . b a c k e n d _ n o d e _ i d ) 
 
                           ) ) 
 
   
 
 -                 r e s u l t :   t y p i n g . T u p l e [ 
 
 -                         c d p . r u n t i m e . R e m o t e O b j e c t ,   t y p i n g . A n y 
 
 -                 ]   =   a w a i t   s e l f . t a b . s e n d ( 
 
 -                         c d p . r u n t i m e . c a l l _ f u n c t i o n _ o n ( 
 
 -                                 j s _ f u n c t i o n , 
 
 -                                 o b j e c t _ i d = s e l f . r e m o t e _ o b j e c t . o b j e c t _ i d , 
 
 -                                 a r g u m e n t s = [ 
 
 -                                         c d p . r u n t i m e . C a l l A r g u m e n t ( o b j e c t _ i d = s e l f . r e m o t e _ o b j e c t . o b j e c t _ i d ) 
 
 -                                 ] , 
 
 -                                 r e t u r n _ b y _ v a l u e = T r u e , 
 
 -                                 u s e r _ g e s t u r e = T r u e , 
 
 -                                 a w a i t _ p r o m i s e = a w a i t _ p r o m i s e , 
 
 +                 t r y : 
 
 +                         r e s u l t :   t y p i n g . T u p l e [ 
 
 +                                 c d p . r u n t i m e . R e m o t e O b j e c t ,   t y p i n g . A n y 
 
 +                         ]   =   a w a i t   s e l f . t a b . s e n d ( 
 
 +                                 c d p . r u n t i m e . c a l l _ f u n c t i o n _ o n ( 
 
 +                                         j s _ f u n c t i o n , 
 
 +                                         o b j e c t _ i d = s e l f . r e m o t e _ o b j e c t . o b j e c t _ i d , 
 
 +                                         a r g u m e n t s = [ 
 
 +                                                 c d p . r u n t i m e . C a l l A r g u m e n t ( o b j e c t _ i d = s e l f . r e m o t e _ o b j e c t . o b j e c t _ i d ) 
 
 +                                         ] , 
 
 +                                         r e t u r n _ b y _ v a l u e = T r u e , 
 
 +                                         u s e r _ g e s t u r e = T r u e , 
 
 +                                         a w a i t _ p r o m i s e = a w a i t _ p r o m i s e , 
 
 +                                 ) 
 
                           ) 
 
 -                 ) 
 
 -                 i f   r e s u l t   a n d   r e s u l t [ 0 ] : 
 
 -                         i f   r e t u r n _ b y _ v a l u e : 
 
 -                                 r e t u r n   r e s u l t [ 0 ] . v a l u e 
 
 -                         r e t u r n   r e s u l t [ 0 ] 
 
 -                 e l i f   r e s u l t [ 1 ] : 
 
 -                         r e t u r n   r e s u l t [ 1 ] 
 
 +                         i f   r e s u l t   a n d   r e s u l t [ 0 ] : 
 
 +                                 i f   r e t u r n _ b y _ v a l u e : 
 
 +                                         r e t u r n   r e s u l t [ 0 ] . v a l u e 
 
 +                                 r e t u r n   r e s u l t [ 0 ] 
 
 +                         e l i f   r e s u l t [ 1 ] : 
 
 +                                 r e t u r n   r e s u l t [ 1 ] 
 
 +                 e x c e p t   E x c e p t i o n   a s   e : 
 
 +                         f r o m   . . c o n n e c t i o n   i m p o r t   P r o t o c o l E x c e p t i o n 
 
 +                         i f   r e t r y   a n d   i s i n s t a n c e ( e ,   P r o t o c o l E x c e p t i o n )   a n d   e . c o d e   = =   - 3 2 0 0 0 : 
 
 +                                 l o g g e r . d e b u g ( f " R e t r y i n g   a p p l y ( )   o n   { s e l f . n o d e _ n a m e }   a f t e r   s t a l e   o b j e c t _ i d   e r r o r " ) 
 
 +                                 s e t a t t r ( s e l f ,   ' _ r e m o t e _ o b j e c t ' ,   N o n e )     #   C l e a r   c a c h e   t o   f o r c e   r e f r e s h 
 
 +                                 a w a i t   s e l f . u p d a t e ( ) 
 
 +                                 r e t u r n   a w a i t   s e l f . a p p l y ( j s _ f u n c t i o n ,   r e t u r n _ b y _ v a l u e ,   a w a i t _ p r o m i s e = a w a i t _ p r o m i s e ,   r e t r y = F a l s e ) 
 
 +                         r a i s e   e 
 
   
 
           a s y n c   d e f   g e t _ p o s i t i o n ( s e l f ,   a b s :   b o o l   =   F a l s e )   - >   P o s i t i o n   |   N o n e : 
 
                   i f   n o t   s e l f . r e m o t e _ o b j e c t   o r   n o t   s e l f . o b j e c t _ i d : 
 
 d i f f   - - g i t   a / t e s t _ f i x e s _ u n i t . p y   b / t e s t _ f i x e s _ u n i t . p y 
 
 n e w   f i l e   m o d e   1 0 0 6 4 4 
 
 i n d e x   0 0 0 0 0 0 0 . . 7 8 f d 9 6 9 
 
 - - -   / d e v / n u l l 
 
 + + +   b / t e s t _ f i x e s _ u n i t . p y 
 
 @ @   - 0 , 0   + 1 , 7 2   @ @ 
 
 + i m p o r t   a s y n c i o 
 
 + i m p o r t   u n i t t e s t 
 
 + f r o m   u n i t t e s t . m o c k   i m p o r t   M a g i c M o c k ,   A s y n c M o c k ,   p a t c h 
 
 + f r o m   c h u s c r a p e r . c o r e . c o n n e c t i o n   i m p o r t   C o n n e c t i o n 
 
 + f r o m   c h u s c r a p e r   i m p o r t   c d p 
 
 + 
 
 + c l a s s   T e s t C o n n e c t i o n F i x ( u n i t t e s t . I s o l a t e d A s y n c i o T e s t C a s e ) : 
 
 +         a s y n c   d e f   t e s t _ t a r g e t _ i d _ r e t u r n s _ t a r g e t _ i d _ o b j e c t ( s e l f ) : 
 
 +                 #   M o c k   t a r g e t   o b j e c t   t h a t   h a s   a   t a r g e t _ i d   a t t r i b u t e   o f   t y p e   c d p . t a r g e t . T a r g e t I D 
 
 +                 m o c k _ t a r g e t _ i d   =   c d p . t a r g e t . T a r g e t I D ( " t e s t - i d - 1 2 3 " ) 
 
 +                 m o c k _ t a r g e t   =   M a g i c M o c k ( ) 
 
 +                 m o c k _ t a r g e t . t a r g e t _ i d   =   m o c k _ t a r g e t _ i d 
 
 + 
 
 +                 c o n n   =   C o n n e c t i o n ( w e b s o c k e t _ u r l = " w s : / / l o c a l h o s t : 1 2 3 4 " ,   t a r g e t = m o c k _ t a r g e t ) 
 
 + 
 
 +                 #   V e r i f y   t a r g e t _ i d   p r o p e r t y   r e t u r n s   t h e   o b j e c t ,   n o t   a   p l a i n   s t r 
 
 +                 s e l f . a s s e r t E q u a l ( c o n n . t a r g e t _ i d ,   m o c k _ t a r g e t _ i d ) 
 
 +                 s e l f . a s s e r t I s I n s t a n c e ( c o n n . t a r g e t _ i d ,   c d p . t a r g e t . T a r g e t I D ) 
 
 +                 #   V e r i f y   i t   h a s   t o _ j s o n   m e t h o d   ( i t ' s   a   s t r   s u b c l a s s   i n   C D P ) 
 
 +                 s e l f . a s s e r t T r u e ( h a s a t t r ( c o n n . t a r g e t _ i d ,   ' t o _ j s o n ' ) ) 
 
 +                 s e l f . a s s e r t E q u a l ( c o n n . t a r g e t _ i d . t o _ j s o n ( ) ,   " t e s t - i d - 1 2 3 " ) 
 
 + 
 
 + c l a s s   T e s t E l e m e n t A p p l y F i x ( u n i t t e s t . I s o l a t e d A s y n c i o T e s t C a s e ) : 
 
 +         a s y n c   d e f   t e s t _ a p p l y _ r e t r i e s _ o n _ s t a l e _ o b j e c t _ i d ( s e l f ) : 
 
 +                 f r o m   c h u s c r a p e r . c o r e . e l e m e n t   i m p o r t   E l e m e n t 
 
 +                 f r o m   c h u s c r a p e r . c o r e . c o n n e c t i o n   i m p o r t   P r o t o c o l E x c e p t i o n 
 
 + 
 
 +                 m o c k _ t a b   =   A s y n c M o c k ( ) 
 
 +                 m o c k _ n o d e   =   M a g i c M o c k ( s p e c = c d p . d o m . N o d e ) 
 
 +                 m o c k _ n o d e . b a c k e n d _ n o d e _ i d   =   c d p . d o m . B a c k e n d N o d e I d ( 1 ) 
 
 +                 m o c k _ n o d e . n o d e _ n a m e   =   " D I V " 
 
 + 
 
 +                 #   I n i t i a l i z e   E l e m e n t 
 
 +                 w i t h   p a t c h ( ' c h u s c r a p e r . c o r e . e l e m e n t . E l e m e n t . _ m a k e _ a t t r s ' ) : 
 
 +                         e l e m   =   E l e m e n t ( n o d e = m o c k _ n o d e ,   t a b = m o c k _ t a b ) 
 
 + 
 
 +                 #   S e t   a   f a k e   r e m o t e _ o b j e c t 
 
 +                 m o c k _ r e m o t e _ o b j e c t   =   M a g i c M o c k ( s p e c = c d p . r u n t i m e . R e m o t e O b j e c t ) 
 
 +                 m o c k _ r e m o t e _ o b j e c t . o b j e c t _ i d   =   c d p . r u n t i m e . R e m o t e O b j e c t I d ( " o l d - i d " ) 
 
 +                 e l e m . _ r e m o t e _ o b j e c t   =   m o c k _ r e m o t e _ o b j e c t 
 
 + 
 
 +                 #   S e t u p   m o c k _ t a b . s e n d   t o   f a i l   f i r s t   t h e n   s u c c e e d 
 
 +                 s t a l e _ e r r o r   =   P r o t o c o l E x c e p t i o n ( { " c o d e " :   - 3 2 0 0 0 ,   " m e s s a g e " :   " C o u l d   n o t   f i n d   o b j e c t   w i t h   g i v e n   i d " } ) 
 
 + 
 
 +                 n e w _ r e m o t e _ o b j e c t   =   M a g i c M o c k ( s p e c = c d p . r u n t i m e . R e m o t e O b j e c t ) 
 
 +                 n e w _ r e m o t e _ o b j e c t . o b j e c t _ i d   =   c d p . r u n t i m e . R e m o t e O b j e c t I d ( " n e w - i d " ) 
 
 +                 n e w _ r e m o t e _ o b j e c t . v a l u e   =   " s u c c e s s " 
 
 + 
 
 +                 s u c c e s s _ r e s u l t   =   ( n e w _ r e m o t e _ o b j e c t ,   N o n e ) 
 
 + 
 
 +                 #   M o c k   u p d a t e   t o   a v o i d   m a k i n g   m o r e   t a b . s e n d   c a l l s   t h a n   e x p e c t e d 
 
 +                 #   A n d   s i m u l a t e   i t   s e t t i n g   a   n e w   r e m o t e   o b j e c t 
 
 +                 a s y n c   d e f   m o c k _ u p d a t e _ f u n c ( ) : 
 
 +                         e l e m . _ r e m o t e _ o b j e c t   =   n e w _ r e m o t e _ o b j e c t 
 
 + 
 
 +                 #   F i r s t   c a l l   f a i l s ,   s e c o n d   c a l l   ( a f t e r   r e t r y )   s u c c e e d s 
 
 +                 m o c k _ t a b . s e n d . s i d e _ e f f e c t   =   [ s t a l e _ e r r o r ,   s u c c e s s _ r e s u l t ] 
 
 + 
 
 +                 w i t h   p a t c h ( ' c h u s c r a p e r . c o r e . e l e m e n t s . i n t e r a c t i o n . E l e m e n t I n t e r a c t i o n M i x i n . u p d a t e ' ,   s i d e _ e f f e c t = m o c k _ u p d a t e _ f u n c )   a s   m o c k _ u p d a t e : 
 
 +                         r e s u l t   =   a w a i t   e l e m . a p p l y ( " ( )   = >   { } " ) 
 
 + 
 
 +                         s e l f . a s s e r t E q u a l ( r e s u l t ,   " s u c c e s s " ) 
 
 +                         s e l f . a s s e r t E q u a l ( m o c k _ t a b . s e n d . c a l l _ c o u n t ,   2 ) 
 
 +                         m o c k _ u p d a t e . a s s e r t _ c a l l e d _ o n c e ( ) 
 
 +                         #   V e r i f y   i t   u s e d   t h e   N E W   r e m o t e   o b j e c t   I D   i n   t h e   s e c o n d   c a l l 
 
 +                         c a l l _ a r g s   =   m o c k _ t a b . s e n d . c a l l _ a r g s _ l i s t [ 1 ] 
 
 +                         #   T h e   f i r s t   a r g u m e n t   t o   t a b . s e n d   i s   t h e   c d p   c o m m a n d   g e n e r a t o r 
 
 +                         #   W e   c a n ' t   e a s i l y   i n s p e c t   t h e   g e n e r a t o r ' s   s t a t e   w i t h o u t   r u n n i n g   i t , 
 
 +                         #   b u t   w e ' v e   v e r i f i e d   t h e   l o g i c   f l o w . 
 
 + 
 
 + i f   _ _ n a m e _ _   = =   " _ _ m a i n _ _ " : 
 
 +         u n i t t e s t . m a i n ( ) 
 
 d i f f   - - g i t   a / v e r i f y _ f i x e s . p y   b / v e r i f y _ f i x e s . p y 
 
 n e w   f i l e   m o d e   1 0 0 6 4 4 
 
 i n d e x   0 0 0 0 0 0 0 . . 6 0 6 0 d 5 1 
 
 - - -   / d e v / n u l l 
 
 + + +   b / v e r i f y _ f i x e s . p y 
 
 @ @   - 0 , 0   + 1 , 4 5   @ @ 
 
 + i m p o r t   a s y n c i o 
 
 + i m p o r t   c h u s c r a p e r   a s   c s 
 
 + i m p o r t   l o g g i n g 
 
 + 
 
 + l o g g i n g . b a s i c C o n f i g ( l e v e l = l o g g i n g . D E B U G ) 
 
 + 
 
 + a s y n c   d e f   v e r i f y _ f i x e s ( ) : 
 
 +         #   U s e   h e a d l e s s = T r u e   f o r   t h e   s a n d b o x   e n v i r o n m e n t 
 
 +         a s y n c   w i t h   a w a i t   c s . s t a r t ( h e a d l e s s = T r u e )   a s   b r o w s e r : 
 
 +                 p r i n t ( " - - -   1 .   T e s t i n g   g o t o ( )   - - - " ) 
 
 +                 t a b   =   a w a i t   b r o w s e r . g e t ( " h t t p s : / / n e u r o f i q . i n " ) 
 
 +                 p r i n t ( f " P a g e   l o a d e d :   { t a b . u r l } " ) 
 
 + 
 
 +                 p r i n t ( " \ n - - -   2 .   T e s t i n g   s c r o l l _ d o w n ( )   - - - " ) 
 
 +                 #   T h i s   u s e d   t o   c r a s h   w i t h   A t t r i b u t e E r r o r :   ' s t r '   o b j e c t   h a s   n o   a t t r i b u t e   ' t o _ j s o n ' 
 
 +                 t r y : 
 
 +                         a w a i t   t a b . s c r o l l _ d o w n ( 1 0 ) 
 
 +                         p r i n t ( " s c r o l l _ d o w n ( 1 0 )   s u c c e s s f u l ! " ) 
 
 +                 e x c e p t   E x c e p t i o n   a s   e : 
 
 +                         p r i n t ( f " s c r o l l _ d o w n ( 1 0 )   f a i l e d :   { e } " ) 
 
 +                         i m p o r t   t r a c e b a c k 
 
 +                         t r a c e b a c k . p r i n t _ e x c ( ) 
 
 + 
 
 +                 p r i n t ( " \ n - - -   3 .   T e s t i n g   f i l l ( )   r e s i l i e n c e   - - - " ) 
 
 +                 #   F i n d   a n   i n p u t   t o   t e s t   f i l l .   E v e n   i f   i t   d o e s n ' t   r e - r e n d e r   i m m e d i a t e l y , 
 
 +                 #   w e   c a n   v e r i f y   t h e   m e t h o d   s t i l l   w o r k s . 
 
 +                 t r y : 
 
 +                         #   T r y   t o   f i n d   a n y   i n p u t 
 
 +                         i n p u t s   =   a w a i t   t a b . q u e r y _ s e l e c t o r _ a l l ( " i n p u t " ) 
 
 +                         i f   i n p u t s : 
 
 +                                 t a r g e t _ i n p u t   =   i n p u t s [ 0 ] 
 
 +                                 p r i n t ( f " F o u n d   i n p u t :   { t a r g e t _ i n p u t . n o d e _ n a m e } " ) 
 
 +                                 a w a i t   t a r g e t _ i n p u t . f i l l ( " t e s t @ e x a m p l e . c o m " ) 
 
 +                                 p r i n t ( " f i l l ( )   s u c c e s s f u l ! " ) 
 
 +                         e l s e : 
 
 +                                 p r i n t ( " N o   i n p u t   f o u n d   t o   t e s t   f i l l ( ) " ) 
 
 +                 e x c e p t   E x c e p t i o n   a s   e : 
 
 +                         p r i n t ( f " f i l l ( )   f a i l e d :   { e } " ) 
 
 +                         i m p o r t   t r a c e b a c k 
 
 +                         t r a c e b a c k . p r i n t _ e x c ( ) 
 
 + 
 
 +                 p r i n t ( " \ n V e r i f i c a t i o n   c o m p l e t e . " ) 
 
 + 
 
 + i f   _ _ n a m e _ _   = =   " _ _ m a i n _ _ " : 
 
 +         a s y n c i o . r u n ( v e r i f y _ f i x e s ( ) ) 
 
 