arnoudbuzing / webtools

A Wolfram Language package which automates interactions with web browsers
Other
33 stars 6 forks source link

A tricky solution to Chinese directory names #8

Closed wjxway closed 6 years ago

wjxway commented 6 years ago

In the switch case in InstallWebUnit[driver_], I suggest to change the code for windows to:

"Windows-x86-64", 
  If[
    Complement[Characters[dir],Join[CharacterRange["0", "z"], Characters@"-."]]=!={},
    SystemOpen[FileNameJoin[{ dir, "chromedriver.exe" }]],
    process = StartProcess[ $SystemShell ]; 
    WriteLine[ process, "start /b " <> FileNameJoin[{ dir, "chromedriver.exe" }] ]
  ]

Or else Chinese characters in dir would lead to initialization failure.

arnoudbuzing commented 6 years ago

Thanks.

Unfortunately that opens a "Command Prompt" window for me, which I don't like to see.

arnoudbuzing commented 6 years ago

Does StartProcess work for you?

For example:

StartProcess["D:\\test\\钨\\chromedriver.exe"]

arnoudbuzing commented 6 years ago

I used the above solution which seems to work for me.

Please note that I had to rename the package from WebUnit to WebTools (to avoid a compatibility issue with an upcoming release of 11.3)

This also means you have to use InstallWebTools instead of InstallWebUnit