Japanese parliamentarians have elected the country’s first female prime minister.