Refactor redundant selector? #15238
              
                
                  
                  
                    Answered
                  
                  by
                    bahmutov
                  
              
          
                  
                    
                      thian4
                    
                  
                
                  asked this question in
                Component Testing
              
            -
| How to refactor below selector? I tried to refactor to this the second assertion failed. https://stackoverflow.com/questions/66380511/cypress-passing-selector-to-variable-for-reuse | 
Beta Was this translation helpful? Give feedback.
      
      
          Answered by
          
            bahmutov
          
      
      
        Feb 26, 2021 
      
    
    Replies: 1 comment
-
| You can use either DOM alias .as or .within command for this. See the full example in https://glebbahmutov.com/cypress-examples/6.5.0/commands/aliasing.html#list-example | 
Beta Was this translation helpful? Give feedback.
                  
                    0 replies
                  
                
            
      Answer selected by
        bahmutov
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
        
    
You can use either DOM alias .as or .within command for this. See the full example in https://glebbahmutov.com/cypress-examples/6.5.0/commands/aliasing.html#list-example