0

there are multiple Tables on the Site with changing IDs, only the active one is Clickable, so i am test like this for the correct one:

def table_test(text):
    rows = driver.find_elements(By.XPATH, '//table/tbody/tr/td[2]')
    for row in rows:
        if row.text == text:
            try:
                row.click()
                break
            except:
                pass

So far this Code works, maybe there is a nicer way for this?

My Main Question is: Each table on the Site got an Selection Field after, how can i identify the correct Selection Field also with changing IDs, after the correct table is found? Can't use the same Method due each Selection Field is useable even it is not the active one.

When i try to find the next Select Field after i found the correct Row, the first Selection Field in the Document is found - so the wrong one.

element = row.find_element(By.XPATH, '//following-sibling::select')
Shark00n
  • 85
  • 1
  • 10
  • What url and what's the html code for it. – Arundeep Chohan Dec 09 '21 at 09:03
  • well an easy way to detect your table and the element in it is to check html for a value that differs between a normal table and the active table or just give absolute path – Yan Dec 09 '21 at 09:19
  • The tables look always the same, the only difference is a random ID. There is no indicator for an active Table. – Shark00n Dec 09 '21 at 09:40

0 Answers0