Problems locating an Object using "preceding-sibling"

So i have a datepicker field with a unique name and an input field before that one which has no unique identifiers. Since handling datepickers with custom keywords seems kinda complicated, i want to locate that input field relative to the datepicker and set the text for the date:

WebElement date1 = driver.findElements(By.xpath(’//input[@name=“B3802”]/preceding-sibling::input[@placeholder=“TT.MM.JJJJ”]’))


    <input type="text" placeholder="TT.MM.JJJJ" value="">
	<input type="date" 
		name="B3802" placeholder="TT.MM.JJJJ" required="" data-datepicker="true" 
		data-message-valuemissing="Please enter date.">


org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object

WebDriver.findElements returns List<WebElement> type, you are trying to cast it to WebElement.

To get a single element, use WebDriver.findElement method. It has nothing to do with your Xpath.

Oh jesus, such little things always get me!
Thank you :slight_smile: