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.driver.get("http://www.kartaca.com/TR/anasayfa")
        self.assertIn("Kartaca - Anasayfa", driver.title)
    def tearDown(self):
        self.driver.close()
if __name__ == "__main__":
    unittest.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



Topics

All Agile Methodology AI and ML (210) Android Anthos (2) Application Modernization B2B Marketing (5) Bamboo C++ Chef ClickHouse Cloud (168) Cloud Migration (19) Cloud Native Development (6) Construction Consumer Goods (3) Customer Experience (2) Data Analytics (44) Data Science (2) Data Storage Data Visualization (8) Database (4) Developer Experience (9) DevOps (15) Digital Marketing (16) Digital Native Businesses (2) Disaster Recovery (2) Django (2) E-Commerce (9) Education (8) Energy Sector (3) Enterprise (5) Financial Services (7) FinOps (4) Firebase (10) Flutter Gaming (16) Git Golang (2) Google Cloud (156) Google Labs (16) Google Maps (3) Google Vids (2) Google Workspace (40) Governance (2) Healthcare & Life Sciences (4) Helm History of Development (3) HR Practices (12) Hybrid and Multi Cloud (8) Industry Cloud (55) Insurance IT JavaScript Kids & Tech (2) Kubernetes (5) Legal Services (2) Leisure and Hospitality (8) Linux (6) Looker (8) Loyalty Marketing (6) Manufacturing (6) MariaDB Mobile App Development (2) MySQL Open Source (28) OpenStack (4) Payment Systems (2) PostgreSQL Project Methodologies Public Sector (3) Python (7) Real Estate Recruitment (7) Regulatory Compliance (2) Resilience Retail (22) Rise Through The Ranks Security (16) Selenium (2) SMBs (10) Software Development (8) Supply Chain and Logistics (6) Sustainability (6) System Architecture (7) Tech Stack (26) Technology, Media, Telecom (8) Terraform Testing (4) Transportation (2) UI & UX Version Control Women in STEM (3)
Show More Topics >> Hide Topics >>

Discover more from Kartaca

Subscribe now to keep reading and get access to the full archive.

Continue reading