Robot framework locates a linked drop-down box Times wrong: element not visible

robot framework locates a linked drop-down box, Times error: element not visible

clipboard.png
Click the code of "Section 0508" as follows

Click Element    //li[text()="0508"]

failed when running as shown in the picture. "Section 0508" appears, but when clicked, it prompts "element not visible"

Mar.21,2021

always thought that the problem was the linkage of the drop-down box, but later I saw someone on the Internet saying that the page had multiple elements with the same attributes, reporting this error. So looked at the options of the first drop-down box, sure enough and the second drop-down box has the same option, and their element structure is exactly the same, so found 2 elements, it is estimated that the default click on the first, but the first drop-down option is not visible at this time, so report "element not visible".
find the reason and solve it. First get all the elements and the number of elements. If the number of elements is equal to 1, click on the first element at this time. If the number of elements is equal to 2, point the second element at this time. The
code is as follows:


    [Arguments]    @{text}
    Wait Until Page Contains Element    css=.ant-select-selection__rendered
    @{DropdownList}    Get WebElements    css=.ant-select-selection__rendered
    Comment    
    ${index}=    Set Variable    0  
    :FOR    ${keyword}    IN    @{DropdownList}
    \    Click Element    @{DropdownList}[${index}]
    \    @{ElementList}    Get WebElements    //li[text()='@{text}[${index}]']  
    \    ${ElementListLen}    Get Element Count    //li[text()='@{text}[${index}]']   
    \    Run Keyword If    ${ElementListLen}==1    Click Element    //li[text()='@{text}[${index}]']    
    \    Run Keyword If    ${ElementListLen}==2    Click Element    @{ElementList}[1]             
    \    ${index}    Evaluate    ${index}+1               
    [Documentation]    texttext
Menu