Prior to the passage of the 17th Amendment, the selection of Senators was left to each of the state legislatures, consistent with Article I, Section 3 of the U.S. Constitution.
In the early 1900s, William Lorimer, a self-educated former meat packer and 6-term Republican Member of Congress from Chicago:
“… presented credentials as a Senator-elect to the United States Senate for the term that had commenced March 4, 1909, and served from June 18, 1909, until July 13, 1912, when, after a Senate investigation and acrimonious debate, the Senate adopted a resolution declaring ‘that corrupt methods and practices were employed in his election, and that the election, therefore, was invalid...’”.
The 17th Amendment was formally proposed by Congress on May 13, 1912 and took effect one year later on May 31, 1913, after majority ratification by three-fourths of the then-48 United States.
—Quote Source: bioguide.congress.gov