Provide source to selenium-webdriver jar in eclipse IDE to understand the flow.



A jar file usually only contains class files and not the java files they were compiled from. 
That's why eclipse is not opening the source code of that class or interface. (control+click)
"Attaching" the source to a JAR means telling eclipse where the source code can be found.
It is always helpful to attach the source of selenium-server standalone jar with your code.
  • You can identify the class and its hierarchy.
  • You can understand how the method of class is executing ans see its code.
  • It makes it easier to debug the problem.
For attaching source to selenium-server-standalone jar follow the following steps.
1) From url: https://www.seleniumhq.org/download/ download java client library under Selenium Client & WebDriver Language Bindings section.(for ex- selenium-java-3.x.x.zip) will be downloaded.
2) Extract this zip file in a new folder. 
3) There will be client-combined-3.x.x-sources.jar in the extracted items.
4) Copy client-combined-3.x.x-sources.jar and put it in your eclipse project.
5) Now select any selenium class with control plus click in eclipse editor. (I selected WebDriver interface from line WebDriver driver = new FirefoxDriver()  using control+click)
6) WebDriver class will open and click on Change Attached Source button.
7) Select Workspace Location and click on Browse.
8) From selection window, select client-combined-3.x.x-sources.jar and click on "OK" and finish the process.
9) Enjoy your work and see the source code in formatted style.
**************************************************************************************

QACult Best Software Testing Courses in Chandigarh tricity.- We love to enhance your knowledge.

QACult is the premier institute catering to the requirements of experienced and fresh pass-out that gives leaders like you a new way to experience Quality engineering—while you work and giving you the flexibility to both advance your career.
Our faculty have 12+ years of industrial experience and have developed many automation testing frameworks in java using TestNG or BDD (cucumber) methodology. We expertise in developing automation testing frameworks in java, python, javascript, php, ruby(WATIR-webdriver & Capybara) and Appium.
please subscribe our channel for more such updates:  

And visit our website: www.qacult.com for various blogs and Upcoming Events.

Comments

Popular posts from this blog

Robot Framework With Python: An Open Source Framework For RPA

Robot Framework in python with RIDE

How to do copy Paste in browser using selenium using Actions class