March 2014

Selenium WebDriver – AdvanceUserInteractions API – Move and click on specific coordinates

Moving mouse over specific coordinates and clicking on it.

Actions vActions = new Actions(vDriver);
vActions.moveByOffset(16, 320);
vActions.click();
Action vClickAction = vActions.build();
vClickAction.perform();

  • Working on Desktop Browsers(mostly known) using Selenium WebDriver
  • Working on Mobile Browsers(ChromeDriver, SafariDriver) using Appium 

Selenium WebDriver : getSize() Vs getLocation()

In Selenium WebDriver getSize() and getLocation() methods are different:

getSize() : will return the “Dimension” object, from which we can get Height and Width of specific element
Dimension vDimesions = vDriver.findElement(By.id(“id“)).getSize();
System.out.println(“Height :” + vDimesions.height + ”Width : “+ vDimesions.width);

getLocation() : will return the “Point” object, from which we can get X and Y coordinates of specific element
Point vPoint=driver.findElement(By.id(“id”)).getLocation();

System.out.println(“X : “+ vPoint.x + “Y : “+ vPoint.y);

Swap two integers

public class Swapvalues {

public void swapInts(int x, int y)
{
System.out.println(“before X =”+x+”Y=”+y);
x = x + y;
y = x – y;
x = x – y;
System.out.println(“after X =”+x+”Y=”+y);
}

public static void main(String args[])
 {
Swapvalues vSwapvalues = new Swapvalues();
vSwapvalues.swapInts(7, 8);
 }
}

What is a branch? What is a fork

Branching and forking provide two ways of diverging from the main code line. Both Mercurial and Git have the concept of branches at the local level. A repository code branch, like a branch of a tree, remains part of the original repository.  The code that is branched (main trunk) and the branch know and rely on each other. Like a tree trunk’s branch, a code branch knows about the trunk (original code base) it originated from.

Fork is another way of saying clone or copy. The term fork (in programming) derives from an Unix system call that created a copy of an existing process. So unlike a branch, a fork is independent from the original repository. If the original repository is deleted, the fork remains. If you fork a repository you get that repository and all of its branches.
As DVCS hosting evolved, the term fork evolved. The Bitbucket software adds management to forks; forking a repository in Bitbucket has functionality you normally wouldn’t associate with a simple DVCS clone. For example, on Bitbucket, you can always see which repository the fork came from. This isn’t the case with a DVCS clone on your local system.

A comparison of branching and forking

Whether you use either branching or forking, and to what extent, depends on your working environment. There are lots of ways a team can work with and combine fork and branch functionality. Generally, for hosted systems, forks work well in situations where, as a repository admin:

  • You don’t want to manage user access on your repository.
  • You want fine-grain control over merging.
  • You expressly want to support independent branches.
  • You want to discard experiments and changes easily.

The Bitbucket team recommends branching for development teams on Bitbucket; We use a modified form of Vincent Driessen’s GitFlow technique.  Bitbucket branches are useful when:

  • You have a small group of programers who trust each other and are in close communication.
  • You are willing to give the development team write access to a repository.
  • You have a rapid iteration cycle.
Ultimately, though it is your choice – branch or fork – Bitbucket supports both.

Cloning a repository fork or branch

When you want to work on a project by updating its files or adding new files, you need to make a local clone of the remote Bitbucket repository onto your machine or local network. You do this using the Clone button from the Bitbucket repository.  If you forked a repository, you simply clone the fork.  If you branched a repository, you clone the repository and checkout the branch.

Error: “ENOENT”

Meanings:
It’s an abbreviation of Error NO ENTry, and can actually be used for more than files/directories.
Cause:
No such file or directory. This is a “file doesn’t exist” error for ordinary files that are referenced in contexts where they are expected to already exist.
source