0

pic 1 table

pic 2

htmlcode

I have a table as pic 1. I need to find one invalid cell (valid: green-background, invalid: red-background). If they're all valid as picture, I must press to back previous page I got script to get current page:

current_page =driver.find_element("//span[@class='currentPage']).get_attribute("innerText")

But I don't know how to loop through each cell of table to find which one valid or not to click or do other actions.

Thank your help in advance

1 Answer 1

1

you can get all elements with a certain class/css selector/whatever by using driver.find_elements_by_whatever_you_want . then you can loop through the elements by using a simple for i in elements loop and get the attribute for every element. you can then say what happens if the cell is valid or not.

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks @Timeler, I get a list of element through valid_ext_list = driver.find_elements("xpath...") but how could I click on any element inside that list?
well you can simply do "for i in valid_ext_list: i.click()

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.