How were United States senators chosen before the general population was able to vote for them?

They were appointed by the president.

They were chosen by both houses of Congress.

They were selected by their respective governors.

They were chosen by state representatives.