A train window was shattered by two youths throwing stones.
British Transport Police (BTP) said the incident happened at around 8.20pm on Wednesday, July 17, as a train travelled along the line close to Wakefield City Golf Course near Lupset.
PC Keith Warner, the investigating officer said: “Fortunately on this occasion, no one was injured as a result, however the consequences could have been far worse.
“This was an extremely foolish and dangerous act, which put the driver and passengers in danger.
“Patrols have now been stepped up in the area to catch and deter any vandals from carrying out this type of extremely dangerous crime.”
One of the suspects was wearing a red T-shirt and had climbed up a signal gantry.
Anyone with any information should contact BTP on 0800 405040 or Crimestoppers anonymously on 0800 555111.