The 49-year-old told a jury the man – identified in court as William Craig – stopped her just after midday to ask directions to Livingston North railway station.
But as she pointed out the way she claimed he asked her repeatedly to “take a drink” from a bottle of Jagermeister and made the threat to rape her “in the bushes”.
She said he then grabbed her by the upper arm and tried to pull her towards shrubbery next to the path.
Giving evidence at Livingston Sheriff Court, she said: “He was right up in my face. Very close, nearly touching distance.
“I remember saying to him: ‘You’re being silly. You’re going to miss your train’ but he was just being persistent.” She told the court Craig repeatedly threatened to rape her in the bushes, adding: “He said it more than once, at least three times.
“I didn’t really react at first. It took me a moment to compose myself.”
She added: “I didn’t really register how serious it was, how things would progress. I think I was in shock.
“I thought I was in danger. I thought I was going to be attacked.”
The woman said that the man left her alone only after a woman she knew emerged from houses next to the path and said she’d overheard what the man had said to her. The second woman phoned the police.
The alleged victim – a carer, who looks after disabled clients – said she was “frightened” by the encounter on in the Knightsridge area of Livingston, West Lothian. She said she was now on medication for anxiety.
She denied a suggestion by Bruce Shields, defending, that she might have misheard what Craig said to her because she had been listening to music on earphones.
She also refuted a suggestion that Craig had made the comments in a “flippant” manner.
Craig, 38, from Cathcart, Glasgow, denies sexually assaulting the woman with intent to rape her on January 31 this year.
The indictment alleges that he seized her by the body, attempting to pull her into the bushes and uttering sexually explicit remarks, all while on bail.
Christine Hannah, 49, who works at the Co-op in North Livingston, said Craig had bought a bottle of Jagermeister in her shop shortly before the alleged attack.
She described him as a “jolly” customer, laughing and dancing about the store just before noon on the day of the alleged assault.
She told the jury: “He said he was from Glasgow and having a good day, having a good drink to himself.
“He said he was going back to Glasgow on the train because Livingston was ‘rubbish’.”
She agreed with Mr Shields’ suggestions that CCTV of Craig in the shop showed a “chatty man” from Glasgow who had been joking with other customers.
Detective sergeant Grant Paterson, 42, of Livingston CID, said the woman was “extremely upset and tearful” when he met her.
He sourced CCTV evidence from Livingston North railway station and a train clearly showing Craig leaving Livingston just before 12.30pm that day.
The trial continues.