'Selenium firefox MOZ_LOG: Logs are truncated after browser quit
I enabled firefox browser http logs as noted here https://firefox-source-docs.mozilla.org/networking/http/logging.html.
In logged_in_selenium fixture browser is finalized by calling selenium.quit(). The issue I have is the logs when test fails are not complete. I think firefox (just a guess) doesn't flush the rest of the log to the file and somehow (ungracefully may be) closed.
When test fails it waits for unmet conditions for 30 seconds, does nothing and then fails with TimeoutException. There is no activity in browser these 30 seconds. And the rest of the log for some reason doesn't get into the file.
@pytest.fixture
def firefox_options(firefox_options):
firefox_options.log.level = "trace"
firefox_options.add_argument('--MOZ_LOG=timestamp,nsHttp:1,cache2:1,nsHostResolver:1,cookie:1')
firefox_options.add_argument(f'--MOZ_LOG_FILE={FIREFOX_SRC_LOG_FN}')
return firefox_options
@pytest.fixture
def logged_in_selenium(selenium, firefox_options, sut_location):
...
wait_for_element_to_be_visible(selenium, '//div[contains(@class, "q-img__content")]/ancestor::div[contains(@class, "cursor-pointer")]')
yield selenium
selenium.quit()
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
