I use python-binding selenium with chromedriver. I use webdriverwait until expected condition of an element is not displayed
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as ec
def view_journal_entry(self):
self.driver.refresh()
self.driver.find_element_by_css_selector('a.small_journal_link.get-ajax-account-transaction').click()
try:
WebDriverWait(self.driver, 10).until(
ec.invisibility_of_element_located((By.CSS_SELECTOR, 'div.blinkdot')))
finally:
pass
def check_journal_entry(self):
self.view_journal_entry()
debit = self.driver.find_element_by_css_selector('td.gl_total_debit').get_attribute('innerHTML')
credit = self.driver.find_element_by_css_selector('td.gl_total_credit').get_attribute('innerHTML')
index = 0
while ((debit != credit) or (debit == '0,00') or (credit == '0,00')) and index < 2:
self.view_journal_entry()
index += 1
if (debit == credit) and (debit != '0,00') and (credit != '0,00'):
print('debit is ' + debit + '\n' + 'credit is ' + credit)
print('journal entry is balanced \n')
self.driver.refresh()
elif (debit == '0,00') or (credit == '0,00'):
print('debit or credit is 0, please check sidekiq \n')
self.driver.refresh()
else:
print('debit is ' + debit + '\n' + 'credit is ' + credit)
print('journal entry is not balanced \n')
self.driver.refresh()
The problem is the webdriver does not wait for the element to be not displayed until the timeout, and the only thing I need is to change normal refresh into refresh bypass cache so that the element is not displayed when I loop the function.
How do you refresh bypass cache using python selenium with chromedriver?