Trying to run the below Selenium code in pycharm, the test is getting executed with no errors but the functions defined inside the class GoogleSearch is not being executed. Need help in finding what is the issue!!
from selenium import webdriver
import time
from selenium.webdriver.common.keys import Keys
import unittest
class GoogleSearch(unittest.TestCase):
print("123")
@classmethod
def setUpClass(cls):
print("456")
cls.driver = webdriver.Chrome()
cls.driver.implicitly_wait(10)
cls.driver.maximize_window()
def test_search_automationstepbystep(self):
self.driver.get("https://google.com")
self.driver.find_element_by_name("q").send_keys("Automation Step by Step")
self.driver.find_element_by_name("btnK").send_keys(Keys.ENTER)
def test_search_kiranmallaiah(self):
self.driver.get("https://google.com")
self.driver.find_element_by_name("q").send_keys("Kiran Mallaiah")
self.driver.find_element_by_name("btnK").send_keys(Keys.ENTER)
@classmethod
def tearDownClass(cls):
cls.time.sleep(3)
cls.driver.close()
cls.driver.quit()
print("Test Completed")
The below is the output:
C:\Users\Indrani\PycharmProjects\SeleniumProject\venv\Scripts\python.exe "C:/Users/Indrani/PycharmProjects/SeleniumProject/Sample Projects/GoogleSearchTest.py"
123
Test Completed
Process finished with exit code 0