How could a scientist from the 1800s to the 1920s run spectroscopy of chemicals?
Light from a flame, the sun, or a star, was passed though a narrow slit, then directed through a prism (F) and observed.  The prism is rotatable about a vertical axis to adjust the wavelength range being observed.  Bright lines in the spectrum are emission transitions and dark lines are absorption transitions.  

Further progress was made using diffraction gratings instead of prisms and using photography instead of naked eye observation.  Photography permitted observation of infrared and ultraviolet lines.   

By these techniques, known elements were detected in the sun and other stars, and helium was discovered in the sun before it was discovered on Earth, all before 1900.

For further information see Spectroscopy History.