How to scan a complete list in selenium

1

I have a screen where I can create users

This screen is made up of 4 columns where:

  • A check-box
  • description
  • Code
  • Status (Active or Inactive)
  • I would like to know how to do the following situation

    I need to inactivate let's say the third user of the list (remembering that I do not know if this user's status is active or inactive)

    If the user is Active, I click on the Inactivate button If it is not, go to the next user and check the status again until you find one that is Active (I would like to disable 1 user in this case)

    And then I would like to verify that the user I chose has changed the status to Inactive

    The problem is that since it is a dynamic list and the screen has no search fields, I can not search for a specific user. I have to scan the entire list of users until I find the user I chose

    Is there any way to do this in Selenium ?

        
    asked by anonymous 19.08.2015 / 19:07

    1 answer

    0

    With selenium + java I did something similar, it is possible.

    1- To find the user you can use the:

    if (driver.getPageSource().contains("aqui vai o nome do usuario")) {
             // aqui no if você faz o que deseja se o usuario foi encontrado
        }
    

    2- Once you locate the user, you check whether the user is active or not;

    // para realizar está verificação, você vai precisar do html da pagina, para localizar o elemento responsável por ativar/desativar,achando este elemento você diz para o selenium marcar/clicar nele
    

    3- To confirm that the user's status has really changed, you can use the same techniques as above (locate the user, then check if his status is xpto ...)

    I believe this method will help you locate the user on the page

    if (driver.getPageSource().contains("aqui vai o nome do usuario")) {
             //encontrou o usuario
        }
    

    But the main thing for you to use selenium is to have access to the page html;

        
    11.01.2017 / 20:56