Electric cars are cool. Running out of juice -- not so much.

The British government is getting ready to test out new road technology that would allow electric cars to charge as they drive. The goal is to help drivers with electric and hybrid cars avoid frequent stops to recharge their vehicles.

Most electric cars get charged via plug-in chargers at home or while parked on the streets. Wireless power charging "pods" are also available, but they too require the car to stop to get more juice.

The new charging roads proposed by the U.K. government will work kind of like wireless phone chargers, using magnetic induction technology.

The initiative is slated to begin later this year, and engineers will install wireless technology in test vehicles and place special equipment under the roads.

Cables buried underneath the highway would generate electromagnetic fields that could be picked up by a receiver in the car and transformed into electric power. The system would include a communication system, so that the roads can detect that a car is coming and start the process.

Related: Win a free Tesla. Hint: It's not easy

For now, the trials will be restricted to test areas where regular drivers aren't allowed. The government is committing £500 million ($779 million) to the project over the next five years.

"Vehicle technologies are advancing at an ever increasing pace and we're committed to supporting the growth of ultra-low emissions vehicles on England's motorways," said the government's chief highways engineer, Mike Wilson.

The government will also expand the number of charging stations available in the country, so there is a plug available every 20 miles.

Similar technology is already used in the South Korean city of Gumi, where shuttle buses covering distances of up to 15 miles get their juice from underground power cables.