The cavity method is a well-established technique for solving classical spin models on sparse random graphs (mean-field models with finite connectivity). Laumann et al. [Phys. Rev. B 78, 134424 (2008)] proposed recently an extension of this method to quantum spin-1⁄2 models in a transverse field, using a discretized Suzuki-Trotter imaginary-time formalism. Here we show how to take analytically the continuous imaginary-time limit. Our main technical contribution is an explicit procedure to generate the spin trajectories in a path-integral representation of the imaginary-time dynamics. As a side result we also show how this procedure can be used in simple heat bath Monte Carlo simulations of generic quantum spin models. The replica symmetric continuous-time quantum cavity method is formulated for a wide class of models and applied as a simple example on the Bethe lattice ferromagnet in a transverse field. The results of the methods are confronted with various approximation schemes in this particular case. On this system we performed quantum Monte Carlo simulations that confirm the exactness of the cavity method in the thermodynamic limit.