Selenium

Selenium is the most popular open source test automation tool especially popular for web based applications and has become backbone for many other platforms.

As we all know that, the future is all about cloud applications which means every application would be web based. Though we have many test automation tools in market considering both paid and open source, a person can create automation assets with the respective tools only if he or she is proficient in the language the tool supports. The biggest advantage about Selenium is, it supports most of the programming languages to create the test automation assets.

Selenium supported scripting languages are

  1. Java
  2. Python
  3. C#
  4. Ruby

So now a person need not worry about learning a language which is supported by the automation tool.

If we are to know a little bit of history of Selenium, it has first started with Selenium IDE and Remote control concepts, they had to add browser plugins to respective browsers.

Selenium supported browsers are

  1. IE
  2. FireFox
  3. Google Chrome
  4. Opera
  5. Safari

So, when the addins been installed, selenium would be able to inject javascript in to web page and perform actions on the UI components and there by used to execute the automation scripts.

Getting started with Selenium IDE once the plugin is installed successfully.

  1. Open a web browser.
  2. Click on the selenium IDE icon.
  3. Click on a record button in the newly opened IDE.
  4. Navigate to the application which you want to test by providing the url in Browser’s address bar.
  5. Perform the steps you want to test on the application one time.

Once this is done Selenium IDE provides options to export the script in to your desired language for Remote Control ( RC  ) format.

Now using Eclipse and supported Jar files for Selenium Remote Control Server and Selenium Client Drivers for java one should be able to execute the selenium scripts.

To understand more details please refer to articles:

  1. Recording scripts using Selenium IDE.
  2. Configuring Selenium Remote Control (RC) using eclipse.

But now the world has moved completely to Selenium Web Driver by looking at the challenges of working with Javascript based engine to record and play back of the scripts.

Getting started with Selenium Web Driver for Test Automation

The basic steps to work with selenium web driver is that, we need to have appropriate JAVA installed, Eclipse IDE and WebDriver Jar files.  Once we have all these ready, need to create a java project in Eclipse IDE and add all the jars extracted from Selenium Web Driver files.

For this approach we need not install any Browser plugins and we should be able to create the test automation assets with the desired scripting language. Also, Selenium does not use javascript engine anymore for creating the test automation scripts.

To learn more about how to create test automation scripts using selenium web driver, please follow below articles

  1. Configuring eclipse to start writing test automation scripts using selenium Web Driver.
  2. First automation script using Selenium Web Driver.
  3. What needs to be done to create Selenium Web Driver Scripts that supports different web browsers?

Comments (16)

  • Hi Srinivas ,

    Could you elaborate Selenium and also could you give an alternative apart from AUTO IT for automation of window application ?

    Could you also include java material as currently this language is mostly used for Automation

    Regards,
    Akhilesh

    Reply
  • Sorry for the delay in Response Akhilesh,

    Regarding automation of Windows Applications, the market leader is QTP and there are some options like UI Automation from Microsoft, that is more known to the Microsoft Experts.

    Selenium, I would be adding more content from now on 🙂

    Regarding java, sure, I would be more than happy to include some articles / tutorials on it. As it is been widely used in test automation.

    Thank you so much for your comments.

    Reply
  • Hi Friends,

    I need small clarification i am testing mobile app while running the script in eclipse i am getting one console as Bsh console “BeanShell 2.0b4 – by Pat Niemeyer (pat@pat.net)
    bsh % ” why the system is showing this console can anyone say to me am i need to configure the run setup?

    Reply
  • Hi Srinivas,

    I have got the solution for that actually i have not installed the testng plugin in eclipse that is the reason eclipse have displayed that Bsh console thank you for responding.

    Thanks,
    Ramesh

    Reply
  • Hi Srinivas,

    While running appium i have got this error can u give any clarification
    ” error: Unhandled error: Error: ENOENT, no such file or directory ‘C:\Users\sivaramesh.k\AppData\Local\Android\sdk1\platform-tools;C:\Users\sivaramesh.k\AppData\Local\Android\sdk1\tools;C:\Users\sivaramesh.k\AppData\Local\Android\sdk1;\build-tools'”

    Reply
  • Hello Sir,

    I need your help in selenium automation test script.

    I was trying to do write a test a case for a website that takes in the Java code , compiles it and runs it. However, while writing the test case , the text-area that takes input did not have all the characters. I saw it was missing ‘(‘ and ‘!’. I tried using the uni-code characters as well as ascii characters.

    Input String is like this : !isBlank(general22)
    In this string “!” and “(“ is not accepting via element.sendKeys
    So I get O/p : isBlankgeneral22)

    I have tried below code :
    String text=!isBlank(general22);
    StringBuilder sbr1 = new StringBuilder();
    sbr1.append(StringEscapeUtils.unescapeJava(“\\u0021”));
    sbr1.append(text.substring(text.lastIndexOf(‘!’)+1,text.lastIndexOf(‘(‘))); sbr1.append(StringEscapeUtils.unescapeJava(“\\u0028”)); sbr1.append(text.substring(text.lastIndexOf(‘(‘)+1,text.lastIndexOf(‘)’))); sbr1.append(StringEscapeUtils.unescapeJava(“\\u0029”));

    But still, it doesn’t work.

    Please suggest me proper answer regarding this problem.

    Reply
  • No, Sir. Website URL is working only is our organisation LAN.
    But, I can share screenshot of that issue.

    Reply
    • Hi Zarana,

      I am really sorry for the delay… was little tied up.

      Just couple minutes back I tried to automate a scenario similar to what you said and I had no issues with normal code it self.

      I was using Selenium-java-3.1.0 and here goes the code:

      public static void main(String rs[])
      {
           System.setProperty("webdriver.chrome.driver","path to downloaded chromerdriver.exe file");
           WebDriver driver = new ChromeDriver();
           driver.get("http://google.com");
           WebElement searchBox = driver.findElement(By.name("q"));
           searchBox.sendKeys("!isBlank(general22)");
      
      }
      
      Reply
  • Thank You Sir. Its working fine with Selenium-java-3.1.0

    Reply
  • I am getting the ” Bsh Console popup ” with message ”Beanshell11 1.3.0 by pat Niemyer’ at the time of runing the java script in Eclipse. pls share your thought to sort it out.

    Reply
  • Hi Srinivas

    Suggest best Selenium Training institute for Real time scenarios explanation.

    Thanks,
    Narendra Reddy

    Reply
    • I don’t think there would be any institute which teaches real time scenarios, but i think there are some who would guide you through a path which will make you gain real time experience. But i am not aware of any institutes as such, as i mostly do things online.

      Reply

Leave a Reply

Your email address will not be published. Required fields are marked *