rows = driver.find_elements(By.XPATH, "//table[@id='orders']//tbody/tr")for row in rows:
cells = row.find_elements(By.TAG_NAME, "td")
order_id = cells[0].text
status = cells[1].text
if status == "PENDING":
row.find_element(By.XPATH, ".//button[text()='Approve']").click()
break