java basics for selenium
Quality,  Selenium,  Software Testing

Java Basics for Selenium

Software Testing is very essential process of Software development life cycle. Basically there are two types of software testing conducts on any software, first is Manual software testing and second is Automation software testing. Automation testing is useful to accelerate the Testing process and for automation we use various tools like Selenium, Apache Jmeter, Sikuli, QTP, Appium, Selendroid etc. Selenium is a most famous and open source tool to automate the web applications but to use this tool we need to know some java basics for selenium, so that we can implement the automation scripts to execute the test cases.

Java Basics for Selenium

Java is most famous scripting language to use in selenium for implementing the automation script. It is an object oriented programming language which has multiple data types like: int, double, float, char, string, array etc.

Methods or Functions:

In programming, blocks or group of statements is known as Methods or Functions.

  • These methods or functions are reusable.
  • We can declare the method with unique name.
  • We can call the method within the method also.
  • We can declare the methods in two formats
  • (i) Non-Static (ii) Static

For example:

  1. Non-Static Method

Syntax: public void Method_Name1() {


  1. Static Method

Syntax: public static void Method_Name2() {




It is a class data type where we can store multiple characters. We can declare the string in two ways:

  1. Locally
  2. Globally

1. Local Declaration:

  • If we declare the string within any method or block, then we will call it as local declaration.
  • The scope of local variables is limited to that specific method only.
  • We can’t use those variables outside of the method.

For example:

public void sample1() {

string str;    // Local declaration

str = ”Rajesh”    // Assigning the value

system.out.println (“Welcome” +str);


If you are planning to use the variables (reference objects) in multiple classes & multiple methods then we need to declare it globally.


2. Global Declaration:

To access the objects (data type, methods & instances) in multiple methods and classes, then we need to declare the objects globally by using the access modifiers like: private, public, protected, & default.

Private: These objects can be used within the class only.

Public: These objects can be used in multiple classes & multiple packages. (Public objects can be used within the project)

For example:

private string str;   // Global declaration

public string s1;    // Global declaration

protected string s2;    // Global declaration



Parameterization means a value or data type. We can pass or send the parameter to the method from the main method is known as parameterization. It is to Reuse the methods.

For example:

public void sample4(string str3) {

system.out.println (“Welcome” +str3);


public static void main(string [] args) {

Basics b = new Basics();   // Instance or object




Please click here to read Automation Script Implementation in Webdriver

Please click here to read Browser Launch in Selenium Webdriver

Please click here to read Features of Selenium Webdriver


  • Hairstyles

    Thanks for your article. What I want to comment on is that while looking for a good on the web electronics retail outlet, look for a website with complete information on important factors such as the privacy statement, safety measures details, payment methods, as well as other terms and policies. Often take time to look into the help and also FAQ segments to get a much better idea of what sort of shop operates, what they are able to do for you, and how you can make the most of the features.

  • Gaylord Allard

    Hi there very nice website!! Man .. Excellent .. Superb .. I will bookmark your site and take the feeds additionally? I am happy to find so many useful info here in the publish, we’d like develop extra strategies in this regard, thank you for sharing. . . . . .|

  • Sharan Roskovensky

    Hey! I know this is kind of off topic but I was wondering which blog platform are you using for this site? I’m getting tired of WordPress because I’ve had issues with hackers and I’m looking at options for another platform. I would be fantastic if you could point me in the direction of a good platform.|

  • Merle Veil

    Does your blog have a contact page? I’m having problems locating it but, I’d like to send you an email. I’ve got some creative ideas for your blog you might be interested in hearing. Either way, great website and I look forward to seeing it expand over time.|

  • Renato Gajda

    This is very interesting, You are a very skilled blogger. I’ve joined your feed and look forward to seeking more of your wonderful post. Also, I’ve shared your website in my social networks!|

  • Jospeh Streit

    I’m truly enjoying the design and layout of your site. It’s a very easy on the eyes which makes it much more enjoyable for me to come here and visit more often. Did you hire out a developer to create your theme? Superb work!|

  • Ferdinand Fedderly

    I think this is one of the most important information for me. And i am glad reading your article. But want to remark on some general things, The website style is great, the articles is really nice : D. Good job, cheers|

  • Armand Gapp

    Can I just say what a relief to find a person that really understands what they’re discussing on the web. You actually realize how to bring an issue to light and make it important. More and more people ought to read this and understand this side of the story. I was surprised that you’re not more popular because you most certainly possess the gift.|


    I blog quite often and I truly appreciate your information. This article has really peaked my interest. I’m going to book mark your site and keep checking for new information about once a week. I opted in for your Feed as well.

  • Joetta Harvest

    Just desire to say your article is as astounding. The clarity in your post is just cool and i could assume you’re an expert on this subject. Well with your permission let me to grab your feed to keep up to date with forthcoming post. Thanks a million and please carry on the gratifying work.|

  • Jayson

    It is the best time to make some plans for the future and it’s time to be happy.

    I’ve read this post and if I could I desire to suggest you some interesting things or suggestions.
    Maybe you could write next articles referring to
    this article. I wish to read even more things about it!

  • jordan shoes

    My husband and i were contented that Edward could finish up his web research because of the ideas he grabbed out of the web page. It’s not at all simplistic to simply choose to be offering facts which others have been making money from. And we also figure out we have the writer to thank for that. Most of the illustrations you made, the simple website menu, the relationships you will give support to create – it’s got all spectacular, and it is facilitating our son and our family recognize that the subject matter is cool, which is truly vital. Thanks for all!

  • g

    Hi! Do you know if they make any plugins to assist with SEO?
    I’m trying to get my blog to rank for some targeted
    keywords but I’m not seeing very good results. If you know of any please share.

  • g

    I got this site from my pal who shared with me concerning this site and now this time I am browsing this web site
    and reading very informative posts at this time.

  • bape clothing

    I would like to get across my affection for your kindness in support of those who absolutely need help with this particular topic. Your real commitment to getting the message all over had been wonderfully powerful and have regularly encouraged ladies just like me to attain their endeavors. Your entire useful facts signifies a whole lot a person like me and much more to my fellow workers. Best wishes; from everyone of us.

  • supreme clothing

    I wish to show my appreciation to you just for rescuing me from such a matter. Right after browsing throughout the the net and obtaining techniques which are not productive, I assumed my life was gone. Existing devoid of the strategies to the difficulties you have resolved as a result of your write-up is a crucial case, and those that could have badly damaged my entire career if I hadn’t discovered your web site. The natural talent and kindness in controlling a lot of stuff was helpful. I’m not sure what I would’ve done if I had not come upon such a solution like this. I am able to at this point look ahead to my future. Thank you so much for your impressive and effective guide. I will not be reluctant to propose your web page to any person who should get tips about this problem.

  • moncler outlet

    I simply wanted to develop a comment to be able to say thanks to you for some of the stunning solutions you are giving at this website. My long internet research has at the end of the day been compensated with incredibly good details to share with my best friends. I ‘d state that that many of us visitors actually are rather endowed to dwell in a remarkable site with very many lovely professionals with very helpful tips. I feel rather happy to have used the site and look forward to tons of more amazing minutes reading here. Thanks a lot once again for everything.

  • moncler

    I have to show my appreciation to the writer just for bailing me out of this particular situation. After searching through the world wide web and coming across opinions which were not helpful, I assumed my life was well over. Being alive minus the strategies to the difficulties you’ve solved through your website is a serious case, as well as those that might have adversely damaged my entire career if I hadn’t come across your web page. Your primary expertise and kindness in handling a lot of things was important. I don’t know what I would’ve done if I had not discovered such a thing like this. I can also now look ahead to my future. Thanks for your time so much for the specialized and result oriented help. I will not think twice to recommend your site to anybody who should receive direction about this issue.

  • goyard handbags

    I wish to show my gratitude for your generosity giving support to persons that have the need for guidance on that matter. Your very own commitment to passing the message all through ended up being particularly important and have specifically allowed most people much like me to realize their goals. Your own warm and helpful suggestions implies so much to me and further more to my office colleagues. Regards; from all of us.

  • curry 6

    I enjoy you because of all your valuable labor on this web page. My aunt take interest in participating in investigations and it’s simple to grasp why. My spouse and i hear all about the compelling medium you present helpful tactics on this website and improve participation from other ones about this subject and our girl is certainly discovering a whole lot. Take advantage of the rest of the year. You are always performing a fabulous job.

  • supreme new york

    I truly wanted to post a simple word in order to thank you for all of the precious ideas you are sharing at this site. My particularly long internet look up has at the end of the day been honored with beneficial facts and techniques to share with my family and friends. I would suppose that many of us visitors are definitely endowed to exist in a wonderful place with very many wonderful professionals with valuable things. I feel very happy to have discovered your entire weblog and look forward to tons of more brilliant times reading here. Thank you once more for all the details.

  • yeezy shoes

    I want to express some appreciation to this writer for rescuing me from this type of condition. As a result of browsing throughout the the web and coming across advice that were not helpful, I figured my life was well over. Being alive without the strategies to the issues you have sorted out as a result of your main review is a critical case, as well as ones which may have in a negative way damaged my career if I had not noticed your site. The talents and kindness in dealing with all the pieces was very useful. I am not sure what I would have done if I had not discovered such a stuff like this. I am able to now relish my future. Thanks very much for this expert and result oriented help. I will not think twice to endorse your web sites to any individual who should receive guidance about this area.

  • goyard handbags

    Thanks a lot for providing individuals with an extraordinarily splendid chance to read articles and blog posts from this web site. It really is so brilliant and also stuffed with amusement for me personally and my office peers to search your website at least three times a week to read the latest tips you have got. And lastly, I’m so certainly astounded considering the superb secrets you serve. Some 4 ideas in this article are in truth the simplest I’ve had.

  • yeezy shoes

    A lot of thanks for all of the efforts on this blog. My niece takes pleasure in managing investigation and it is obvious why. We hear all relating to the lively manner you make useful thoughts via your web site and in addition cause participation from website visitors on that matter then our girl is now understanding a lot. Take advantage of the rest of the new year. You’re the one carrying out a tremendous job.

  • nike shox

    Aw, this was a really nice post. In idea I want to put in writing like this moreover ?taking time and precise effort to make an excellent article?however what can I say?I procrastinate alot and under no circumstances appear to get something done.

  • curry 7 shoes

    Can I simply say what a relief to find someone who actually is aware of what theyre speaking about on the internet. You definitely know find out how to bring an issue to gentle and make it important. Extra people have to learn this and understand this facet of the story. I cant imagine youre no more standard since you positively have the gift.

  • spongebob kyrie 5

    Youre so cool! I dont suppose Ive read something like this before. So nice to search out any person with some original ideas on this subject. realy thanks for starting this up. this website is one thing that is wanted on the net, someone with a little bit originality. useful job for bringing one thing new to the internet!

  • Quentin Swing

    Can I simply say what a comfort to uncover an individual who actually knows what they’re talking about on the internet. You definitely know how to bring a problem to light and make it important. A lot more people have to read this and understand this side of the story. I was surprised you aren’t more popular given that you surely possess the gift.

  • Bradly Dockery

    Hello! A person in my Facebook group shared this website with us, so I involved give it a look. I’m taking pleasure in the information. I’m bookmarking and will be tweeting this to my fans! Fantastic blog as well as remarkable style and design.

  • gold or silver ira

    After I initially commented I clicked the -Notify me when new comments are added- checkbox and now every time a remark is added I get 4 emails with the same comment. Is there any manner you possibly can take away me from that service? Thanks!

  • Wendell Dry

    I beloved up to you will receive carried out proper here. The caricature is attractive, your authored subject matter stylish. nevertheless, you command get got an impatience over that you wish be handing over the following. unwell for sure come further formerly again since precisely the same nearly very regularly within case you defend this hike.

  • amazon advertising for books

    Hi there! Quick question that’s entirely off topic. Do you know how to make your site mobile friendly? My blog looks weird when viewing from my apple iphone. I’m trying to find a theme or plugin that might be able to resolve this issue. If you have any recommendations, please share. Thank you!

  • Ami

    I have been browsing online more than three hours today, yet I never found any interesting article like yours. It is pretty worth enough for me. In my view, if all site owners and bloggers made good content as you did, the net will be a lot more useful than ever before.

Leave a Reply

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