I've looked at the sort of "prehistory" of science fiction before, if you're interested:
In a strict sense, no. This is because electricity is a physical phenomena, with many manifestations, and so predates humanity, much less human literature.
In a broader sense, humans have known of electricity for a couple centuries now, and so the knowledge of it certainly predates much genre fiction, and even before the discovery of science as a discipline - but it was not used in the sense of technology; automatons in older stories are not powered by whalebone, but by springs and clockwork or, more commonly, by indeterminate animating forces.
Arguably one of the first expressions of what would become "science fiction" was Mary Shelley's Frankenstein; or, The Modern Prometheus (1818). Inspired by galvanic experiments at the time:
The catastrophe of this tree excited my extreme astonishment; and I eagerly inquired of my father the nature and origin of thunder and lightning. he replied "Electricity;" describing at the same time the various effects of that power. He constructed a small electrical machine, and exhibited a few experiments; he made also a kite, with a wire and spring, which drew down that fluid from the clouds.
This was long before household electricity, and there was still a good bit of confusion over the details - note how Shelley is still describing electricity in terms of a "fluid." The gradual improvement and spread of electrical technology, however, did serve as an impetus for science fiction. In A Connecticut Yankee in King Arthur's Court (1889) for example, Mark Twain includes among the modern technologies the electric light, telegraph, and telephone. His way of signaling the return to the dark ages was literal:
I found Clarence alone in his quarters, drowned in melancholy; and in place of the electric light, he had reinstituted the ancient rag-lamp, and sat there in grisly twilight with all curtains drawn tight.
The focus on the practical effects of electricity was felt in a good deal of the literature of the late 19th century, which understood the effect of electricity even if the operation or details were somewhat obscure to most laypersons - the inclusion of an electric torch or dynamo or radio did not by itself make a story "scientific," but it did become more common. Lord Dunsany in his short story "Three Infernal Jokes" (1916) for example:
"I think you will find my firm will give a good price for it," he said: and without more ado he began with a pair of pincers to cut the wire of the telephone and the receiver. The old waiter who looked after the club they had left shuffling round the other room putting things away for the night.
"Whatever are you doing of?" said my friend.
"This way," said the stranger. Along a passage they went and away to the back of the club and there the stranger leaned out of a window and fastened the severed wires to the lightning conductor. My friend has no doubt of that, a broad ribbon of copper, half an inch wide, perhaps wider, running down from the roof to the earth.
"Hell," said the stranger with his mouth to the telephone; then silence for a while with his ear to the receiver, leaning out of the window.
This is, strictly speaking, fantasy more than science fiction, but it gives you the idea. Still, the turn of the century was marked by several tremendous electrical marvels, and an overall spirit of invention - which led to a surge of interest in fiction concerning electrical devices, especially of the "gadget" kind.
This is probably best exemplified by Hugo Gernsback, who began publishing a magazine for electrical enthusiasts in 1908 titled Modern Electrics, which in addition to its non-fiction articles serialized his "scientifiction" story Ralph 124C 41+ - almost entirely devoted to electrical gadgeteering. Gernsback would later start another magazine, the Electrical Experimenter (1913) which became Science and Invention (1920) which became Practical Electrics (1921) which became The Experimenter (1924). In 1926, he retired The Experimenter to publish Amazing Stories, the first pulp magazine devoted to scientifiction (also called "pseudo-scientific" stories).
The wonder of electricity have never quite faded away, but as understanding has become more widespread and technology has advanced the focus has shifted somewhat.