Take the 2-minute tour ×
Software Quality Assurance & Testing Stack Exchange is a question and answer site for software quality control experts, automation engineers, and software testers. It's 100% free, no registration required.

I used Selenium IDE to automate the project. Now I started learning Webdriver. In IDE, there are few commands like label and Goto labels, where I can create a bunch of code under a label and use gotolable to jump to the label. How the same can be done using webdriver.

share|improve this question
    
What language are you using? –  PaulDonny Mar 4 at 16:55
    
I am learning Java, and using it to automate –  sathiya Mar 5 at 8:11
    
Thanks Sathiya. It sounds like you are asking about Java Functions (A section of code that can be called from another portion of code, to summarize). Could you put more details into your question. Maybe an example. I will go ahead and write up an answer for your question and if it fits, great. But if you could please still add more information regarding the question. It helps people out a lot when they are searching for the answer to the question you asked. Thanks! –  PaulDonny Mar 5 at 12:52

2 Answers 2

Webdriver is an API, not a programming language. Java has statement labels and GoTo's, but if you use them frequently, you are not using the language the way it was intended. Consider using if-statements, loops, and methods instead.

share|improve this answer

It sounds like you are wanting to use functions. These are snippets of code that will allow you to call the code in multiple different portions of your program. Functions are amazing and extremely important to understand if you want to progress with the WebDriver.

Here is an extremely simple example function:

protected void functionExample(String text) {
    System.out.println(text);
}

And this function would be called with functionExample("test"); and it would print the word 'test' to your output. I strongly STRONGLY suggest learning the basics to Java before continuing with the WebDriver. Build some simple Hello World scripts and study some string manipulation techniques.

If you need more information regarding functions, Java has an extensive community and I am confident that you can find a lot of amazing resources for it.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.