There are tons of questions about this error however none of them could be able to help my case.
First i get the main url's ids that i need
url = 'http://www.mosquedirectory.co.uk/browse/uk/england/london'
browser = webdriver.Chrome()
browser.get(url)
listing = browser.find_elements_by_id('directory_listingBrowse')
and I append them in to list to avoid from the error but it is not even worked
hold = []
for i in listing:
hold.append(i)
and from these hold list I loop in for loop and this is also the rest of the code
for i in hold:
try: ulclass = i.find_elements_by_css_selector('ul.c')
except StaleElementReferenceException:
pass
link = []
for i in ulclass:
a = i.find_element_by_tag_name('a')
link.append(a.get_attribute('href'))
for i in link:
browser.get(i)
browser.get(url)
time.sleep(2)
I even tried to avoid the error by using try method, not worked again. And at the end of the code I say get back to old page, again to avoid the error. It's not even worked again. Which part am I missing.