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.
- Anybody can ask a question
- Anybody can answer
- The best answers are voted up and rise to the top
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:
And this function would be called with
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.
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.