HOME/Articles/

selenium Example21AssertIsNone (snippet)

Article Outline

Python web automation, selenium example 'Example21AssertIsNone'

Modules used in program:

  • import unittest

Example21AssertIsNone

Python selenium example: Example21AssertIsNone

import unittest
from selenium import webdriver


class Test(unittest.TestCase):
    def testName(self):
        self.driver = webdriver.Chrome("C:\\Users\\benpe\\DevMountain\\testing-resources\\chromedriver.exe")
        self.assertIsNotNone(self.driver)

        self.driver = None
        self.assertIsNone(self.driver)


if __name__ == "__main__":
    unittest.main()