Python Forum
Selenium does not keep the table? - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: Web Scraping & Web Development (https://python-forum.io/forum-13.html)
+--- Thread: Selenium does not keep the table? (/thread-33707.html)



Selenium does not keep the table? - euras - May-19-2021

I scrape a table with Selenium. When I found the match, I click on the row, which navigates me to the next page. I do a couple of things in that page, then click Back button on that page, which brings me back to the previous page, where the table is. I expect Selenium to grab next row and check the results there, but instead of that, the whole script just stops. Does Selenium not contain the table in variable, if the page loads to the next page and then goes back? In autohotkey it does that. i.e. I found a match in row[4], do some action, click Back, get to the main updated page, and then I expect Selenium to grab row[5] to check and proceed.

contents = driver.find_element_by_id("searchResultTable").find_elements_by_tag_name("tr")
for inda, content in enumerate(contents):
   td = content.find_elements_by_tag_name("td")
   for ind, ttd in enumerate(td):
      if ind == 7:
      # proceeds some actions with a new opened page and click "Back" which brings me back to the main Table
      break



RE: Selenium does not keep the table? - Monish - Jun-05-2021

Hi there, I don't know the answer of your query , but if you want to learn selenium with python see this tutorial