いるのを

… doing

→ 居る
phrase Common #2,482
… doing Used after a verb in ている form to make the action or state the object of a verb such as 見る (to see). の turns the preceding clause into a noun-like phrase, and を marks it as the object.
JA: 彼が本を読んでいるのを見た。
EN: I saw him reading a book.

先生は授業中その学生が居眠りをしているのをみつけた。

The teacher caught the student dozing off during class.

彼はトイレで煙草を吸っているのを見つかった。

He was caught smoking in the bathroom.

彼は父親が台所で倒れているのをみつけた。

He found his father collapsed in the kitchen.