Customers Contact TR

Test Automation Using Selenium


Selenium is a test tool that automates tests. You can use multiple programming languages like Java, C#, Python etc to create Selenium Test Scripts. And also with the Selenium-IDE that also has a Firefox extension, you can easily automate your tests without learning any required programming languages.


Test automation;

  • supports regression tests.
  • provides quick feedback for developers.
  • allows repeating test cases.

A Javascript library was developed for re-running Selenium in multiple browsers. As a result, Selenium Core, based on the Selenium IDE and Selenium RC (Remote Control), was created. Javascript security restrictions of browsers have made some situations impossible for Selenium. That’s why WebDriver was developed.


Selenium Tools:

  • Selenium IDE: a tool with a Firefox extension to create test commands. Using the Selenium IDE, test cases are recorded and executed so that reusable test commands are generated.
  • Selenium RC: allows multiple tests to be performed continuously and works with a Selenium RC server.
  • Selenium Grid: can work with multiple servers similar to Selenium RC. It works parallel, which means it can run different tests on different remote machines simultaneously.
  • Selenium WebDriver: does not send Javascript functionality to the browser as a method of Selenium RC.

For example, let’s write a small test using Webdriver in Python. Firstly, you need to install the Selenium module for Python. Then, let’s open Kartaca’s Turkish web page with our application and check the title information.

import unittest
from selenium import webdriver
class FFKartacaTest(unittest.TestCase):
    def setUp(self):
        self.driver = webdriver.Firefox()
    def test_baslik(self): 
        self.assertIn("Kartaca - Anasayfa", driver.title)
    def tearDown(self):
if __name__ == "__main__":

We can write multiple tests into the class we define. Tests run in alphabetical order (according to the method name), and after each test, the tearDown method is automatically called. We can use Firefox’s Firepath and Firebug tools to find the browser elements that will interact with the program. The elements can be found by the class name (find_element_by_class_name), by CSS (find_element_by_css_selector), by the element id (find_element_by_id). These elements can be a form element or a menu. We can fill out forms using Webdriver’s methods and navigate pages by clicking on the links.

Author: Kartaca