Overview
X-ray fluorescence, shortened to XRF, is a quick and non-destructive way to read the elemental make-up of a part. A handheld or benchtop instrument hits the sample with X-rays, the atoms fluoresce, and the instrument reads the energy that comes back to tell which elements are present and roughly how much.
In RoHS work XRF is the first filter, not the verdict. It can spot elements like lead, mercury, cadmium and bromine within seconds and without cutting the part open, which makes it ideal for sorting a large batch into "clearly fine" and "needs a closer look."
What XRF cannot do is identify the exact compound. It sees the element bromine but not whether it sits in a restricted flame retardant, and it reads the whole spot rather than a single homogeneous material. So a flagged sample moves on to the wet-chemistry methods defined in IEC 62321, which give the precise result that backs a RoHS claim.
XRF tells you where to look, not whether you pass. A positive screen is a reason to test further, and the screening and the lab result both belong in the technical documentation.
Note: general educational information, not legal advice. Check the official source before relying on it.