0

I'm trying to figure out if I should set something in Protractor to tell it I'm testing from a Windows machine so it can be smarter when it comes to things like the Windows file paths.

Using the solution from this question, How to upload file in angularjs e2e protractor testing , I wrote some code to do a file upload in Protractor for a test. Working on Windows I ran into issues with the fact that Windows uses the \ character for file paths, instead of the typical Linux / character. If I go through and manually set each \ character to \\\\ it works as expected. Eureka! But this seems like an oversight on my part somewhere. Windows is not an unexpected platform for testing. Why do I have to write special code around specifically over-escaping the \ character so my Window's file paths work?

Edit: As @floor mentioned in a comment, can also replace the \ character with /, as Windows accepts it as well now. Avoids the ugly replace I spoke of before.

Is there something I should be setting in my Protractor config? Or a special version of sendkeys() (I haven't found any, but I might be missing something)? Also, did the behavior of this change when it comes to Windows anytime in the last 2 years? I feel like this should be a more common question to be found by the new to Protractor on Windows programmers such as myself and it seems like the older questions that seemed to have the user working on Windows didn't seem to have any gotcha's about the \ character being an "invalid or unexpected" character. I remembered it was so from similar issues when working on Java, but I feel like this is something easy to overlook.

S.Huston
  • 254
  • 6
  • 18

0 Answers0