If you have installed Jenkins using homebrew and if you want to uninstall it completely, this is how you do it:
brew uninstall jenkins --force brew cleanup
If you have installed it as a package from Jenkins.io follow this post.
How to uninstall Jenkins from MAC
I installed Jenkins as pkgfrom jenkins.io. There was some issue and I wanted to delete it. I couldn’t find Jenkins folder or Uninstall Command ($/Library/Application\ Support/Jenkins/Uninstall.command) in Library, so this is what I did,
Go to /Applications–> Delete the Jenkins folder
Delete /Users/Shared/Jenkins
Delete Jenkins user(there will be a standarduser with no nameusername for the first time when jenkins is installed) from “Users & Groups”
After this I re-installed Jenkins and it seem to work.
A library performs specific, well-defined operations. A framework is a skeleton where the application defines the “meat” of the operation by filling out the skeleton. The skeleton still has code to link up the parts but the most important work is done by the application.
Many of us will be unaware of this difference which is really important to understand during development. The possible answer to this question, if asked, will be “Framework is a collection of various libraries”. However, this definition is not entirely true. “Who calls whom” i.e. the caller/callee relationship defines the difference between the two terms. It is our code which calls the library code while in framework, it is framework’s code which calls our code. Let’s see how.
Library
A library provides a set of helper functions/objects/modules which your application code calls for specific functionality. Libraries typically focus on a narrow scope (e.g., strings, IO, sockets), so their API’s also tend to be smaller and require fewer dependencies. It is just a collection of class definitions. Why we need them? The reason being very simple i.e. code reuse, use the code which has already been written by other developers. Example, some library has a method named findLastIndex(char) to find the last index of a particular character in a string. We can straightaway call findLastIndex(charToFind) function of the library and pass the characters whose position we need to find as a parameter in the function call.
Framework
Framework, on the other hand has defined open or unimplemented functions or objects which the user writes to create a custom application. (C++/Java users will understand this as it is much like implementing an abstract function). Because a framework is itself an application, it has a wider scope and includes almost everything necessary to make a user application as per his own needs. Wikipedia makes it more clear:
“In computer programming, a software framework is an abstraction in which software providing generic functionality can be selectively changed by additional user-written code, thus providing application-specific software”
Thus, the key difference is in the “Inversion of Control”, commonly called as IoC. When we call a method from a library, we are in control. But in framework, the control is inverted i.e. the framework calls us. It defines a skeleton where the application defines its own features to fill out the skeleton. Example, in Javascript, we usually use this:
$(document.ready(){ // this call will be done by the jquery
// framework when document will be ready.
function() {
/* your code */ // our implementation inside the framework's function
}
});
While in library, we normally have its object to call its functions or we simply call them. Ex:
str = "nysoft.usa"
var pos = str.lastIndexOf("."); // simply calling function of string library
Important Points:
Library : It performs a set of specific and well-defined operations. Examples : Network protocols, compression, image manipulation, string utilities, regular expression evaluation, math etc
Framework: It is known to be a skeleton where the application defines the content of the operation by filling out the skeleton. Examples of frameworks: Web application system, Plug-in manager, GUI system. The framework only defines the concept but an application further defines the functionality that is useful for end-users.
Inversion of control: When we call a method from a library, we are in control. But in framework, the control is inverted i.e. the framework calls us.
In this example we will discuss about the usage of normalize-space in Xpath.
We already aware of the Functions like text(),contains(),starts-with(),last() and position() in Xpath. Refer to this link to know details about these functions. Xpath Functions.
Generally, normalize-space(String s) is a method in Xpath useful to remove any leading or trailing spaces in a String. This is also works like a trim() function in java.lang.String class. We will see different examples
In the above example the table data has spaces for Thomas Cook. If we use Xpath Text Function it doesnt provide any value as an output. Please check the screenshot below:
Usage of normalize-space(text()) method in Xpath.Please check the screenshot below:
Selenium WebDriver Example to fetch the price for a particular Stock:
package org.totalqa.selenium;
import java.util.List;
import org.openqa.selenium.By;
import org.openqa.selenium.NoSuchElementException;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
public class XpathAxesLocators {
public static void main(String[] args) {
System.setProperty("webdriver.gecko.driver", "geckodriver.exe");
FirefoxDriver driver = new FirefoxDriver();
driver.get("https://money.rediff.com/gainers/bse/daily/groupa?src=gain_lose");
/**
* Solution 1 using Axes Locators
*/
WebElement e = driver.findElement(By.xpath("//a[normalize-space(text())='Thomas Cook (I)']/parent::td/following-sibling::td[2]"));
try{
if(e.isDisplayed())
{
String price = e.getText();
System.out.println("Stock Price" + price);
}
}
catch(NoSuchElementException ex)
{
System.out.println("Stock Name Not Exists"+ ex.getMessage());
}
/**
* Solution 2 using findElements()
*/
List<WebElement> trList = driver.findElements(By.xpath(".//*[@id='leftcontainer']/table/tbody/tr/td[1]/a"));
for(int i=0;i<trList.size();i++)
{
if(trList.get(i).getText().contains("Thomas Cook (I)"))
{
e = driver.findElement(By.xpath(".//*[@id='leftcontainer']/table/tbody/tr["+(i+1)+"/td[3]"));
System.out.println("Stock Price:::" + e.getText());
break;
}
}
}
}
Therefor the extra spaces in the table data is ignored and identified the element and fetches the stock price.
Output:
Stock Price::: 244.60
Conclusion:
In the example we have learnt how to use the normalize-space in Xpath.