The story is told in eight major parts, called Scenes.
Scene One begins in 1846, at Combe-Raven in West Somerset, the country residence of the wealthy Vanstone family: Andrew Vanstone, his wife, and their two daughters. Norah, age 26, is happy and quiet; Magdalen, 18, is beautiful but volatile and willful. They live in peace and contentment, looked after by their governess, Miss Garth.
Through amateur theatricals, Magdalen discovers she is a talented actress and falls in love with Frank Clare, the idle but handsome son of a neighbour, who is also in the play. They want to be married, and their fathers agree. Although Frank fails at every career he reluctantly tries, and his father is not wealthy, Magdalen's fortune will easily support the young couple.
But before they marry, Mr. Vanstone is killed in a train crash and Mrs. Vanstone dies in childbirth. The girls discover from the lawyer, Mr. Pendril, that their parents have only been married for a few months, and their wedding invalidated the will which left everything to the daughters.
Since the daughters are illegitimate, they have no name, no rights, and no property. Combe-Raven and the entire family fortune are inherited by Andrew's older brother, Michael Vanstone, who has been bitterly estranged from the family for many years. He refuses to provide any support for the orphaned young women. With the help only of their governess Miss Garth, they set out to make their own way in the world.
Scene Two is set in York, where Magdalen enlists the help of Captain Wragge, a distant relative of her mother's and a professional swindler. He helps get Magdalen started on the stage in return for a share of the proceeds. His wife Matilda, whom he married for an expected inheritance, is physically huge and kindly but mentally slow; she has to be supervised like a child.
Scene Three is in Vauxhall Walk, Lambeth. Magdalen, having earned some money, forsakes the stage and plots to get her inheritance back. Michael Vanstone has died; his only son Noel is sickly and looked after by his housekeeper, Virginie Lecount, a shrewd woman who hopes to inherit his money. Magdalen goes to Lambeth disguised as Miss Garth to see how the land lies, but Mrs. Lecount sees through her disguise and cuts a bit of cloth from the hem of her brown alpaca dress as a keepsake.
Scene Four is in Aldborough, Suffolk, where Magdalen tries to carry out her plot to regain her inheritance by marrying Noel Vanstone under an assumed name, with Captain and Mrs. Wragge posing as her uncle and aunt. Wragge and Lecount plot and attempt to outdo each other. In the end, Lecount is sent on a false errand to Zurich, and Magdalen and Noel are married. Captain Wragge arranges the marriage on condition that he will never have to see Magdalen again once it has happened.
Scene Five is in Baliol Cottage, Dumfries. Noel is alone, as his wife has left to visit her sister in London. Mrs. Lecount is back from Zurich and explains who his wife really is, with the help of the cut bit of cloth from the brown alpaca dress. Noel, at her direction, rewrites his will, cutting off his wife and leaving a legacy to Lecount and everything else to Admiral Bartram, his cousin. He encloses a secret letter, asking Admiral Bartram that the money be passed to young George Bartram, but only on the condition that he marry someone not a widow within six months, thus ensuring that Magdalen cannot marry George for the money. The strain of this scheming is too much for Noel, and he dies from a weak heart.
Scene Six is in St John's Wood where Magdalen has lodgings. Estranged from Norah and from Miss Garth, who she thinks betrayed her husband's whereabouts to Lecount, she hatches a plot to disguise herself as a maid and infiltrate into Admiral Bartram's house to look for the Secret Trust document. Her own maid Louisa helps to train her in return for Magdalen's giving her the money to marry her fiance, the father of her illegitimate child, and move to Australia.
Scene Seven is at St. Crux, the Bartram country house. Magdalen, working under Louisa's name as a parlour maid for Admiral Bartram, searches through the house for the Secret Trust. Eventually she manages it by following Admiral Bartram as he sleepwalks, but she is discovered and thrown out of the house.
The last scene is set in a poor lodging house, Aaron's Building. Magdalen is ill and destitute, about to be carried off to hospital or the workhouse, when a handsome man appears and rescues her. It is Captain Kirke, a sailor who had seen and become enamored of her at Aldborough. Meanwhile, Norah has married George Bartram, thus placing the inheritance back into the Vanstone family. Magdalen, in her illness and recovery, vows to be a better person and never again undertake any malice. Kirke and Magdalen profess their love for one another.

Question: How did Magdalen find the Secret Trust? 
Answer: By following Admiral Bartram when he sleptwalk. 
Alternative answer: She follows Admiral Bartram as he sleepwalks.