Hero Background

Next-Gen App & Browser Testing Cloud

Trusted by 2 Mn+ QAs & Devs to accelerate their release cycles

Next-Gen App & Browser Testing Cloud
  • Home
  • /
  • Blog
  • /
  • Write Your First Automation Script In Just 20 Mins!
Automation

Write Your First Automation Script In Just 20 Mins!

In today’s world, testing can not be efficient without automation. We need automation for avoiding repetitive work, making sure that the time from development to deployment is reduced with good quality.

Author

Nishant Kashyap

January 11, 2026

What Is The Need For Automation?

In today’s world, testing can not be efficient without automation. We need automation for avoiding repetitive work, making sure that the time from development to deployment is reduced with good quality.In order to achieve these, we need reliable automation tests and regression suite. Manual test(s) should just support automation for feature/product testing and release not vice-versa.

We need good, quality automation tests, not just automation tests. We need tests which are reliable, robust, easy to code, debug, scale and can run in parallel on distributed environment.

How do I write my first UI test?

One love for Selenium! Isn’t it ?

Since, Selenium is an open source testing tool it serves the need for cost-effective automation testing and the community always support the cost effective tool with required features. It’s capability to operate on almost every OS and multiple language support i.e. Pearl, PHP,Python, Java, .NET(C#) and Ruby provides the flexibility that every user wants. The language which is mostly used for building the program is independent of the language that is being used by the web application or website. Which implies that you can develop the test script in any of the mentioned languages that the Selenium supports.

You can also hasten your Selenium script generation by using AI test assistants like KaneAI.

KaneAI by TestMu AI is a GenAI Native QA Agent-as-a-Service platform crafted for quality engineering teams. It offers AI-driven features for test authoring, management, and debugging. With KaneAI, users can effortlessly create and modify complex test cases using natural language, making it faster and easier to start with test automation without needing deep technical expertise.

You can quickly generate your Selenium automation script by simply describing your testing needs in natural language. KaneAI effortlessly converts your instructions into a functional script, cutting down the time and complexity typically involved in getting started.

...

There are several ways to quickly start automating a GUI flow using Selenium. Let’s do it using python.

Pre-Req : We need python and selenium binding to be installed in the machine. If you don’t have already , follow the below steps.

  • Download and install Python :-
    • MAC: https://www.python.org/downloads/mac-osx/
    • Linux: https://www.python.org/downloads/source/
    • Windows: https://www.python.org/downloads/windows/

    Command to check python version using command line :- python –version

  • Install selenium libraries for python. [
  • http://selenium-python.readthedocs.io/installation.html ]

    command:- pip install selenium

  • Install geckodriver
  • Since we will use latest version of selenium(3.0) with latest firefox bindings , download geckodriver :- https://github.com/mozilla/geckodriver/releases

    OR Install using command line ( using brew ):- brew install geckodriver

    We are all set to write our first test!  Let’s search for an item in myntra.com

    Code [ Self Explanatory]:

    from selenium import webdriver
    from selenium.webdriver.common.by import By
    from selenium.webdriver.support.ui import WebDriverWait
    from selenium.webdriver.support import expected_conditions as EC
    from selenium.webdriver.common.keys import Keys
    from selenium.webdriver.support.ui import Select
    from random import randint
    
    browser = webdriver.Firefox()
    browser.set_page_load_timeout(30)
    
    browser.get('https://www.myntra.com/')
    assert "Online Shopping" in browser.title
    
    search = browser.find_element_by_class_name("desktop-searchBar")  # Find the search box by class
    search.send_keys("watch") #send the value of search field
    
    submit_button = browser.find_element_by_class_name("desktop-submit")
    submit_button.click()
    #Lets wait for lobby page to load
    delay = 10 # seconds max wait
    myElem = WebDriverWait(browser, delay).until(EC.presence_of_element_located((By.CLASS_NAME, "horizontal-filters-title")))
    browser.save_screenshot("loggedIn.png") ## This will be stored in the location/path mentioned or the current directory
    browser.close() # close browser
    

    Tips:- Locate selenium elements for python – http://selenium-python.readthedocs.io/locating-elements.html

    The below glimpse of Selenium Advanced certification is ideal for testing professionals who want to acquire advanced, hands-on knowledge in Selenium automation testing.

Author

Nishant Kashyap is a community contributor with 18+ years of experience in engineering leadership, product development, and quality-driven platform delivery. As VP of Engineering, he has led large-scale teams across backend, frontend, mobile, infrastructure, security, and quality engineering, ensuring high-quality, production-ready systems. Nishant has driven CI/CD integration, code coverage, verification engines, and automation-led quality practices while building and scaling platforms from 0→1 to high-scale systems. He holds a B.Tech in Computer Science and has worked across domains including gaming, healthcare, and e-commerce.

Close

Summarize with AI

ChatGPT IconPerplexity IconClaude AI IconGrok IconGoogle AI Icon

Did you find this page helpful?

More Related Hubs

TestMu AI forEnterprise

Get access to solutions built on Enterprise
grade security, privacy, & compliance

  • Advanced access controls
  • Advanced data retention rules
  • Advanced Local Testing
  • Premium Support options
  • Early access to beta features
  • Private Slack Channel
  • Unlimited Manual Accessibility DevTools Tests