1
I have a list containing hundreds of data in the format
[
'5008489',
'Órgão: MPF',
'PROCEDIMENTO DO JUIZADO ESPECIAL',
'CPF',
<selenium.webdriver.remote.webelement.WebElement (session="8834847081a4be257906cce85807f88a", element="0.34327825856075167-261")>,
'SERGIO AUGUSTO NOME FICTICIO'
]
Since item 0 is the process number, the penultimate item is the corresponding checkbox and the latter is the CURRENT responsible.
I also have another list with all the possible responsible.
Finally I have a list with several processes, which I need to REDISTRIBUTE TO NEW RESPONSIBLE.
I thought I’d do it this way:
1 - Identify, in the list of processes to be redistributed, who will receive new processes;
2 - From the first name, select all the processes that will go to it;
3 - Click on the respective checkbox;
4 - Finalising the distribution.
I did the following job, but it doesn’t seem satisfactory:
def DistribuiProcesso():
distribuir = Select(browser.find_element_by_id('listaResponsaveis'))
responsaveis = distribuir.options
for x in range(len(responsaveis)):
for y in range(len(processosAlvo)): #Iterando a lista dos processos que serão redistribuidos...
for z in range(len(processosAlvo[y])): #Iterando os itens de cada processo...
if z == len(processosAlvo[y]) - 1: #Localizando o item que contém o nome do responsável...
responsavelAlvo = processosAlvo[y][z]
if responsavelAlvo == responsaveis[x].text:
if z == len(processosAlvo[y]) - 2: #Localizando o item que contém o checkbox...
processosAlvo[y][z].click()
I ask for your help to devise a better reasoning.