Extraction of arsenic from arsenic-containing cobalt and nickel slag and preparation of arsenic-bearing compounds