jeudi 8 juillet 2021

What do I miss in my code that it fails on "adv_acc_search_table" variable? The actual table does not have

I am trying to use if statement to find and click any tr tag elements in a table and if its not available then continue with else. Here is my code below and screenshot of HTML for the table which has tr tags. I want to run this code with no tr tag elements in a table but it fails.

What do I miss? Any suggestions.

adv_acc_search_table = wait.until(EC.visibility_of_any_elements_located((By.CSS_SELECTOR, '[class="standard_table_body"]>table tr')))
try:                               
    for account in adv_acc_search_table:
        if account > 0:
            account.click()
            break
        else:
            print("No Accounts to select")
            wait.until(EC.presence_of_element_located((By.CSS_SELECTOR, '[id="advanced_account_search_window_window_title"] img'))).click()
            APA = Select(wait.until(EC.visibility_of_element_located((By.ID, 'MLADAT'))))
            APA.select_by_index(0)                                  
except:
    TimeoutException

enter image description here

HTML

Aucun commentaire:

Enregistrer un commentaire