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() {

              }

 

String:

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:

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

sample4(“Vinod”);

sample4(“Deepak”);

}

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

28 Comments

  • 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.|

  • espn.com/activate

    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.
    Thanks!

  • 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.

Leave a Reply

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