Is it possible to upload file during test using behat and Selenium2 with relative path? I am doing it like this in my Page Class:
$element = $this->getElement('Upload file');
$element->attachFile('full_path_to_file');
When I am using full path it works just fine, but it doesn't work with relative path. Can I somehow configure it in behat.yaml?
Let's say your current working directory is
C:\Programs\php\directory
and the file you want to upload is in:
C:\Programs\php\directory\images\image.png
Then you can use getcwd()
like this:
$element = $this->getElement('Upload file');
$element -> attachFile(getcwd() . '\images\image.png');