The party obtaining a postponement of a trial, if required by the adverse party, must consent that the testimony of any witness of such adverse party, who is in attendance, be then taken by deposition before a judge or clerk of the court in which the case is pending, or before such notary public as the court may indicate, which must accordingly be done; and the testimony so taken may be read on the trial, with the same effect, and subject to the same objections, as if the witnesses were produced.