You can do that, and I have, but it isn't profitable.
For many years, I collected old PCs, printers, cellphones, big flat screen TVs, and such for that purpose. It takes a lot of time and effort to strip all of the gold parts. My garage was full of junk electronics, and it took me an entire summer to clear it out.
I started by cutting out all of the gold and stripping down old hard drives to get the platinum off of the disks (I still have the disks). Once I had a pile of the good stuff, I got rid of the junk. I started by using a torch to melt the parts, thinking the gold would melt first and pool together to make it easier to extract. But they contain too much copper and lead solder.
So, I bought an ounce of mercury. One ounce of mercury will dissolve an ounce of gold, and I knew I had less than an ounce of gold. Once the mercury did its work, it left an amalgam, which is mercury and pure gold. By straining it through a cloth, I was able to remove the junk, and that left me with just the amalgam.
The next step is the dangerous part. Heating the amalgam to evaporate the mercury. Mercury vapors are deadly poisonous. I rented a campsite for a weekend, dumped the amalgam in an old cast-iron skillet, and roasted it over a campfire. It was winter, so there were no other campers around, and I could keep away and upwind from the fire.
Once that is done, it leaves a chocolate brown, rusty colored dust in the pan. That is 99.999% pure gold. By heating the dust with a torch, it melts into droplets, and their shiny gold color returns. It was very disappointing.
After all of that work and the cost of the mercury ($40 per ounce plus hazardous shipping charge), it wasn't worth it. I have worked less hard to find a flake of gold that was bigger than that.
Can it be done? Yes. Why doesn't everyone do it? It isn't worth it.
I installed a security system at a precious metals recycling plant. That was a huge operation. They took electronic parts like circuit boards and put them in baskets that were lowered into pools of acid. The pools were about the size of small swimming pools. The acid dissolves the gold, and they dispose of the junk. Once the acid becomes saturated, they add a chemical that causes the gold to precipitate out of the acid so they can collect it.
Gold can be extracted from seawater. There are huge amounts of gold dissolved in the oceans. But the process to get it makes it seem futile. You can also make gold, like the ancient alchemists tried to do, but they didn't have access to particle accelerators to get it done.
I prefer to let Mother Earth do the hard work for me, so I can just go pick it up out of the dirt.
😁