I have a WebElement list with notes and another WebElement list with the corresponding buttons. If a note in the list matches the variable fullstring I want to click on the corresponding button. E.g. if note 1 holds fullstring I want to click on the first button in the list. If note three holds the list I want to click on the corresponding third button in the button list. My code looks like this:
fullstring = "monthly"
signListNoteType = WebDriverWait(driver, 40).until(
EC.presence_of_all_elements_located((By.XPATH, xpathSignListNoteType)))
noteButtonList = WebDriverWait(driver, 40).until(
EC.presence_of_all_elements_located((By.XPATH, xpathNoteButtonList)))
for index, noteType in enumerate(signListNoteType, start=0): # default start of index is zero
index = index
noteType = noteType.text
print("Index:", index, noteType)
for index, noteButton in enumerate(noteButtonList, start=0): # default start of index is zero
index = index
noteButton = noteButton
print("Index:", index, noteButton)
if noteType == fullstring:
But I don't know how to code the logic.