Learn, by following the steps given below:
Take a power cable and connect the devices.
Turn on the computer (Windows/MAC), router, and HP printer.
Download & install the HP printer driver and software on the device.
Place the printer near to the wifi-router.
Go to network settings and tab on wireless setting
Click on wireless setup wizard and enter router user name & password.
Wait for a wireless connection and take a test print.