Unable to connect to the internet on my iMac despite being connected to the network
Below are a number of things you can try (apologies for anything obvious, but I take nothing for granted).

Restart the iMac

Does restarting the iMac do anything? Rebooting can often resolve these types of issues.

Disable/Enable Wi-Fi

Similar to restarting, but without needing to. You can use the Wi-Fi menu to turn Wi-Fi off. Try this for about a minute and then turn it back on. This also often works.

Boot into Safe Mode

Follow these steps boot your Mac into Safe Mode:


Fully shut down your iMac
Restart your iMac
Immediately press the Shift key and keep it down 
Let go of the Shift key when you see the login window (NOTE: If you have FileVault enabled you may need to log in twice).
Take a note of what happens (i.e. can you now connect to the Wi-Fi network)
To exit Safe Mode just restart your Mac as normal


The act of booting into Safe Mode will actually perform a number of background tasks, and this often resolves issues when you've rebooted normally.

Once you've tried the above let me know how you go.

[EDIT]

Okay, let's continue troubleshooting...

Run Wireless Diagnostics

You can use Wireless Diagnostics to analyse your Wi-Fi network. Follow these steps:


Close any apps you have running
Connect to the Wi-Fi network
Hold down the option key and go to the Wi-Fi status menu and select Open Wireless Diagnostics
Enter your administrator name and password


Now follow the steps to see whether any problems are found.

Try another 'Wi-Fi' network

It'd be interesting to see whether your iMac can get internet connectivity from another Wi-Fi network. Can you share an internet connection from an iPhone's cellular connection (or similar) and connect to that via your iMac's Wi-Fi port? Does this allow your iMac to browse the web, send/receive emails, etc?

If you can't get an internet connection, then I'd be testing your hardware, although it may be worth first resetting the NVRAM and SMC (in that order). See below for steps.

Reset NVRAM

Your iMac uses Non-Volatile Random-Access Memory (NVRAM) to store many of its settings. You can reset this with the following steps:


Shut down your iMac. Yes, a full shut down, not just logging out.
Press the power button and then press the commandoptionpr keys. You have to make sure you press these keys before the gray screen appears or it won’t work.
Hold those keys down until your iMac reboots again and you here the startup chime.
Let go of the keys and let your iMac reboot normally.


Note: When you log back in you may need to readjust some of your system preferences (e.g. speaker volume, screen resolution, startup disk selection, time zone information, etc).

Now proceed to resetting the SMC.

Reset the SMC

Your iMac has a System Management Controller. It may be worth you resetting this too:


Shut down your iMac
Unplug it from power
Wait 15 seconds
Plug the power cord back in
Wait for an additional 5 seconds
Press the power button to turn it back on


How does your iMac go with connecting now?

Run Apple Diagnostics

If all else has failed, follow the steps below to run Apple Diagnostics:


Fully shut down your iMac
Restart your iMac
Immediately press the D key and keep it down until you see the Diagnostics screen appear
Wait for Diagnostics to finish (this typically only takes a few minutes)
Once complete, one of two things will appear on the screen:


a No issues found message
a brief description of any errors found plus further instructions

If the diagnostics test does find errors, take a note of what they are


Note: If pressing and holding the D key at Step 3 doesn't work, start again at Step 1 and, at Step 3 press and hold both the OptionD keys instead. This will try and run diagnostics from the internet instead, so you will need to allow more time for it to complete. 

Regardless, take a note of what happens and let me know how you went.