Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@haradreborn
Created October 16, 2014 08:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save haradreborn/2208e6cf78773c5cb7d8 to your computer and use it in GitHub Desktop.
Save haradreborn/2208e6cf78773c5cb7d8 to your computer and use it in GitHub Desktop.
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