Wednesday, 10 May 2017

Selenium Webdriver : How to upload file using his relative path (javascript)

I'm using selenium webdriver with node.js (javascript ) under chrome.

In some test , i have to upload a file using his relative path (my file to upload is in the same directory as the test file)

var fileInput = driver.findElement(webdriver.By.xpath('//*[@id="j_idt69:j_idt70_input"]'));
fileInput.sendKeys('./file.xml');

Strangely my test fails and i catch this error :

My error handler... WebDriverError: unknown error: path is not absolute: 

In fact am using a relative path because my test is intented to be used in differents locations (VMs , jenkins , pc..). and the absolute path isn't usefull for me.

Suggestions ??



via firasKoubaa

No comments:

Post a Comment