I had same problem of no internet connection via wifi, despite everything else working.
Solution was to set a fixed IP address, eg 192.168.1.33 (pick last 2/3 digits to be clear of any other devices)
To be safe, you can allocate the address in your router to the pi.