bright-fish / node-ui-automation

MIT License
2 stars 1 forks source link

help with install #6

Open andrisi opened 1 year ago

andrisi commented 1 year ago

Could you add more information on the tools required to install, and the nodejs versions supported? It fails for me on node 16, while other node-gyp dependent things do build. This would be a very important tool for the nodejs commonity on Window if you continue developing it. Thanks.

bright-fish commented 1 year ago

Hi Andris,

Yeah that is a good idea.

Send me a log of the failure and I can possibly get you up and running sooner. The library does work with node 16. Most likely the node settings for detecting Visual Studio are not quite right, or Visual Studio Community is not installed.

The install typically goes like this.

  1. Install Visual Studio Community, make sure to check the "Desktop development with c++" workload.
  2. Attempt to npm install @bright-fish/node-ui-automation the package.
  3. If there is an error that it cannot find the Visual Studio version, you may have to set msvs_version to the year of Visual Studio Community that you have installed. The command is npm config set msvs_version 2022. Only do this if node-gyp complains that it cannot find the version.
andrisi commented 1 year ago

thanks @bright-fish I was missing Visual Studio, so will install and try again

andrisi commented 1 year ago

2022-12-29T20_03_54_846Z-debug-0.log

still fails, and it seems that with problems with the source code (see below), have a look if you have time Chris - any help apreciated

112 error c:\develop\rateroller\node_modules\@bright-fish\node-ui-automation\enumerations\annotationtypeidswrapper.cc(31): error C2065: 'AnnotationType_Sensitive': undeclared identifier [C:\Develop\rateroller\node_modules\@bright-fish\node-ui-automation\build\Automation.vcxproj]
112 error c:\develop\rateroller\node_modules\@bright-fish\node-ui-automation\enumerations\annotationtypeidswrapper.cc(31): error C2672: 'Napi::Object::Set': no matching overloaded function found [C:\Develop\rateroller\node_modules\@bright-fish\node-ui-automation\build\Automation.vcxproj]
112 error c:\develop\rateroller\node_modules\@bright-fish\node-ui-automation\enumerations\annotationtypeidswrapper.cc(31): error C2780: 'bool Napi::Object::Set(uint32_t,const ValueType &)': expects 2 arguments - 1 provided [C:\Develop\rateroller\node_modules\@bright-fish\node-ui-automation\build\Automation.vcxproj]
112 error   c:\develop\rateroller\node_modules\@bright-fish\node-ui-automation\node_modules\node-addon-api\napi.h(874): note: see declaration of 'Napi::Object::Set'
112 error c:\develop\rateroller\node_modules\@bright-fish\node-ui-automation\enumerations\annotationtypeidswrapper.cc(31): error C2780: 'bool Napi::Object::Set(const std::string &,const ValueType &)': expects 2 arguments - 1 provided [C:\Develop\rateroller\node_modules\@bright-fish\node-ui-automation\build\Automation.vcxproj]
112 error   c:\develop\rateroller\node_modules\@bright-fish\node-ui-automation\node_modules\node-addon-api\napi.h(841): note: see declaration of 'Napi::Object::Set'
112 error c:\develop\rateroller\node_modules\@bright-fish\node-ui-automation\enumerations\annotationtypeidswrapper.cc(31): error C2780: 'bool Napi::Object::Set(const char *,const ValueType &)': expects 2 arguments - 1 provided [C:\Develop\rateroller\node_modules\@bright-fish\node-ui-automation\build\Automation.vcxproj]
112 error   c:\develop\rateroller\node_modules\@bright-fish\node-ui-automation\node_modules\node-addon-api\napi.h(835): note: see declaration of 'Napi::Object::Set'
112 error c:\develop\rateroller\node_modules\@bright-fish\node-ui-automation\enumerations\annotationtypeidswrapper.cc(31): error C2780: 'bool Napi::Object::Set(Napi::Value,const ValueType &)': expects 2 arguments - 1 provided [C:\Develop\rateroller\node_modules\@bright-fish\node-ui-automation\build\Automation.vcxproj]
112 error   c:\develop\rateroller\node_modules\@bright-fish\node-ui-automation\node_modules\node-addon-api\napi.h(829): note: see declaration of 'Napi::Object::Set'
112 error c:\develop\rateroller\node_modules\@bright-fish\node-ui-automation\enumerations\annotationtypeidswrapper.cc(31): error C2780: 'bool Napi::Object::Set(napi_value,const ValueType &)': expects 2 arguments - 1 provided [C:\Develop\rateroller\node_modules\@bright-fish\node-ui-automation\build\Automation.vcxproj]
112 error   c:\develop\rateroller\node_modules\@bright-fish\node-ui-automation\node_modules\node-addon-api\napi.h(823): note: see declaration of 'Napi::Object::Set'
bright-fish commented 1 year ago

So I looked into this tonight, and was unable to repro the build failure.

I setup node 16.15.0, with npm 8.16.0, and node-gyp 9.0.0 using nvm. It did build successfully.

The thing I did not get lined up was Visual Studio 2017. I was unable to find a version of Visual Studio 2017 Community to test with. In the logs its choosing 2017.

My guess is the header files for the UI Automation framework are shipped with the Visual Studio version, and those header files are missing AnnotationType_Sensitive in Visual Studio 2017.

Try installing Visual Studio 2019 or 2022 and see if that gets you further. Make sure in the logs node-gyp is choosing Visual Studio 2019 or 2022. That can be switched using msvs_version like I mentioned previously.

andrisi commented 1 year ago

I had multiple partially installed Visual Studio instances I think, now after cleanup, your package builds. Thanks for looking into this. Perhaps a few examples would help, or pointers to C based examples elsewhere that could be easily adopted, like listing all desktop windows, or something like that. I'm looking into the docs, and will try to dig up something too - will report back. If this would work well, it could be a replacement for the sort-of-dead WinAppDriver from MS.