I’m looking for an adverb that means an action is done with some hope, but with not much expectation of success. Gamely is the closest I’ve come.
Example: She dug ___ly into the ground, hoping the pipe was there, even though it really could have been anywhere.
Example: I installed the dubiously-sourced component into the circuit, screwed all the terminals tight, and flipped the switch ___ly.
Example: Pat was pretty sure the bank account had gotten zeroed. Still, he ___ly shoved the cash machine card into the slot.
You could use wishfully
having or showing a wish; desirous; longing.
Maybe not the exact definition you are looking for, but used in the context of the sentences you provided, I think it would work