Q: How do i locate this webelement in Selenium Webdriver? My problem is locating a checkbox element on my webpage. I'm using Selenium webdriver with Eclipse, TestNG and Java as chosen language. 
Inspecting the checkbox element gives me the following:
<input type="checkbox" data-privid="13" data-priviligeeid="406">

I've tried using the following xpath code, where the string is the xpath copied from the element in Chrome browser. I added the escape chararacters for the quotation marks to be accepted:
WebElement ChangeButton = driver.findElement(By.xpath("[@id=\"privs\"]/div[1]/div[2]/label/input"));

But doing this leaves ChangeButton empty. 
I also tried looping through an array until i find a specifik data-privid value:
ArrayList<WebElement> inputs  =(ArrayList<WebElement>)driver.findElements(By.tagName("input"));     

      if(inputs != null) {

          for(WebElement checkbox : inputs) {
              String attribute = checkbox.getAttribute("data-privid");
              System.out.println(attribute);

              ....
}
}

This did not work either, as attribute never gets any values.
Any ideas how I can solve this?
EDIT: This has been solved!
The reason your solutions didn't work for me at first, was because I had navigation in methods belonging to one class, and the web element grabbing in a second class. I tried to combine them in an xml file, but for some reason I ended up on the wrong url when the locator class tried to do its thing. Thank you everyone for providing answers. I went with the css locators and it works beautifully.

A: Try below XPath
//input[@type='checkbox' and @data-privid='13']

Hope it will help you :)

A: No need to use XPath. CSS selectors are more handy. Try this:
driver.findElement(By.cssSelector("input[type='checkbox'][data-privid='13']"));


A: Your xpaht expression "[@id=\"privs\"]/div[1]/div[2]/label/input" is not valid.
Seems you try to find at first step  a element with id="privs" this would be: "*[@id='privs']" or (better if this element is a div)  "div[@id='privs']" 
Then your xpath may look like this:
"div[@id='privs']/div[1]/div[2]/label/input"
