Test Overview
This test opens Firefox with a custom configuration to disable notifications and verifies the browser launches correctly with the set preferences.
This test opens Firefox with a custom configuration to disable notifications and verifies the browser launches correctly with the set preferences.
from selenium import webdriver from selenium.webdriver.firefox.options import Options from selenium.webdriver.firefox.service import Service from selenium.webdriver.common.by import By import unittest class TestFirefoxConfig(unittest.TestCase): def setUp(self): options = Options() options.set_preference("dom.webnotifications.enabled", False) self.driver = webdriver.Firefox(options=options) def test_firefox_launch_with_config(self): self.driver.get("https://www.example.com") element = self.driver.find_element(By.TAG_NAME, "h1") self.assertEqual(element.text, "Example Domain") def tearDown(self): self.driver.quit() if __name__ == "__main__": unittest.main()
| Step | Action | System State | Assertion | Result |
|---|---|---|---|---|
| 1 | Test starts and Firefox options are set to disable notifications | Firefox options object created with 'dom.webnotifications.enabled' set to False | - | PASS |
| 2 | Firefox browser is launched with the configured options | Firefox browser window opens without notification prompts | - | PASS |
| 3 | Browser navigates to 'https://www.example.com' | Example Domain page is loaded and visible | - | PASS |
| 4 | Find the <h1> element on the page | <h1> element with text 'Example Domain' is present | Check that the <h1> text equals 'Example Domain' | PASS |
| 5 | Close the browser and end the test | Firefox browser window closes | - | PASS |