I am attempting to loop through a bunch of rows on a table with Selenium, but am finding that I get an error when attempting to do so. The code should loop through and capture each row in a variable and then compare it against my reference variable, but it throws an error indicating that I've added an invalid or illegal selector.
Please find my code below:
for record in range(35, 2, -1):
current_record = self.browser.find_element_by_css_selector('#web-body > div > div _
> div > div > div > div > _
div:nth-child(2) > div > div > div > div > div > div:nth-child(2) _
> div.FieldLayout---input_below > div > _
div.PagingGridLayout---scrollable_content > table _
> tbody > tr:nth-child(record) > td:nth-child(2) > div > p > a')
print('the current record is: ' + current_record.text)
#print the current record for debugging purposes
if self.entry_test_id != current_record.text:
continue
#if the current record in the loop != the correct record, go to the next record
else:
web_was_record_found = True #note that record was found for next check
actions.key_down(Keys.SHIFT).click(current_record).key_up(Keys.SHIFT).perform()
#open the found record in a new WINDOW
_mean?