0

I'm trying to use Selenium to automatically download some reports based on a date that I input.

The page is updated by Javascript.

Sometimes the list of reports to download can take a while to load so I've used the WebDriverWait function.

There are several pages that can have no reports. This brings up a different css_selector to a page that has reports.

css_selector with no reports = "#report-list"

css_selector with reports = "#no_reports"

I've done a search online but the only solution I can find is for Java: Selenium Wait for anyone of Element to visible

I've tried the code below but that doesn't work.

wait = WebDriverWait(browser, 10)
        wait.until(EC.visibility_of_element_located((By.CSS_SELECTOR, "#reports-list","#no_reports")))
A-Aron
  • 29
  • 6

1 Answers1

1

To wait two elements in single css selector use:

wait.until(EC.visibility_of_element_located((By.CSS_SELECTOR, "#reports-list, #no_reports")))

In your code mistake is (By.CSS_SELECTOR, "#reports-list","#no_reports").

Sers
  • 12,047
  • 2
  • 12
  • 31