Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Selenium unittest example structure
import unittest
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.common.exceptions import NoSuchElementException
import os
chromedriver = "D:\\chromedriver.exe"
os.environ["webdriver.chrome.driver"] = chromedriver
class CS(unittest.TestCase):
def setUp(self):
self.driver = webdriver.Chrome(chromedriver)
def test_samsung_apps_loading(self):
driver = self.driver
driver.get("http://www.samsung.com/ru/home")
self.assertIn("Samsung", driver.title)
def tearDown(self):
self.driver.close()
if __name__ == "__main__":
unittest.main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.