public functionattachFile(string $xpath, string $path) {
$field = $this->getFormField($xpath);
if (!$field instanceof FileFormField) {
thrownewDriverException(sprintf('Impossible to attach a file on the element with XPath "%s" as it is not a file input', $xpath));
}
$field->upload($path);
}