Automating Microsoft OfficeJS Word Add-in
In one of Opcito’s recent business engagements, we came across an add-in automation requirement, and we found it remarkably interesting. The primary reason was the difference between automating an add-in and automating a web or a desktop application. When we tried to do our research, we could not find anything on the topic; not a single video or anything on eLearning sites, even the leading tech bloggers had very little information.
After a lot of R&D and trial and error, we finally discovered an approach to automate it with Appium’s WinAppDriver. We implemented this in Node.js using open-source automation tools and technologies. It’s best to have the correct combination of different tools and their versions. We will explain our add-in automation setup in this blog.
Pre-requisite: Tools, versions, and dependencies
You would need to install the following tools along with the specified versions:
- WinAppDriver 126.96.36.199,
- Node.js 8.17.0,
- npm 6.13.4,
- Appium 1.15.1,
- Download Visual Studio 2017 with workload “Desktop development with C++” and Windows SDK 10 using the Visual Studio installer. Do not forget to turn on the developer mode on your system.
Once all the tools are installed. Follow the steps below to install the required dependencies:
- Open command prompt in admin mode and go to the location of the project folder
- Run command “npm install email@example.com -f”
- Run command “npm install firstname.lastname@example.org”
- Make sure you have all dependencies with the proper version number in the package.json file of the project.
- Here are the required dependencies:
- Run command “npm install” to install all dependencies.
- A node module folder will be created after successfully running the npm install command, and the project’s folder structure will look like this:
We have used the WD library as NodeJS Webdriver/Selenium 2 client in this setup. This library is meant to be a malleable implementation of the Webdriver protocol in Node.
By default, the host address is 127.0.0.1, and port 4723 is used. WD promiseChainRemote is used to define the type of driver… Read more.