Upload file using Relative Path

617 views
Skip to first unread message

Ruppy

unread,
Sep 24, 2012, 4:58:17 PM9/24/12
to seleniu...@googlegroups.com
Hi Everyone,
 
 
I need help with file upload using relative path, to run my webdriver tests on any machine/server.Right now I use send keys - absolute path("C:\\Users\\webDriver\\uploads\\Soft-Aid Test.CSV") and it works fine but to make test run  on other machine or on tools server, I have to get rid of this hard coded file path.
 
Need help with this.
 
Thanks
 
Ruppy

Ruppy

unread,
Sep 25, 2012, 4:48:11 PM9/25/12
to seleniu...@googlegroups.com

Mike Riley

unread,
Oct 8, 2012, 3:32:09 PM10/8/12
to seleniu...@googlegroups.com
Without a much better description of what you are trying to do, I don't see how we can help you.  We don't know how to change your path for your other systems, because we don't know how they are configured.

I used a network mount that was identical for all development and test systems, so absolute paths "just worked".

Mike


On Monday, September 24, 2012 1:58:17 PM UTC-7, Ruppy wrote:

Neeraj Sharma

unread,
Oct 8, 2012, 11:06:41 PM10/8/12
to seleniu...@googlegroups.com
Hi Ruppy,

To do this first of all you need to save you file too in the same location under your project by creating a another folder say Config folder. If your files is in the same package then you can use the relative xpath is like this:-

Workbook wrkbook = Workbook.getWorkbook(new File(System.getProperty("user.dir")+"\\config\\Excel.xls"));

Thanks,
Neeraj Sharma
Reply all
Reply to author
Forward
0 new messages