mardi 30 mars 2021

Unit test case not working in python selenium

I tries below unit test case and it doesnt open web browser and print directly "done" message.

from selenium import webdriver import unittest

class GoogleSearch(unittest.TestCase):

# driver = None

@classmethod
def setUpClass(cls):
    cls.driver = webdriver.Chrome(executable_path='../Drivers/chromedriver')
    cls.driver.maximize_window()

def test_search(self):
    self.driver.get('https://www.google.com')
    self.driver.find_element_by_name("q").send_keys("facebook")
    self.driver.implicitly_wait(10)
    self.driver.find_element_by_name("btnI").click()
    # driver.find_element_by_name("btnI").send_keys(Keys.ENTER)

@classmethod
def tearDownClass(cls):
    # driver.implicitly_wait(5)
    cls.driver.quit()
    cls.print("test completed")

print("done")

Aucun commentaire:

Enregistrer un commentaire