The focus of the effort to make overhead charging viable is on large trucks that already drive mostly, but not completely, predefined routes on highways and in cities, which are often too lengthy to only rely on battery packs.
Transporting refrigerated goods over moderate distances and last-mile delivery from the train yards are where trucks using overhead cables can shine.
I also read that there existed trolleybus lines that went several miles/kilometers between towns that weren't connected by rail. It's especially useful in mountainous terrain.