The 1912 Midlothian by-election was a Parliamentary by-election held on 10 September 1912. The constituency returned one Member of Parliament (MP) to the House of Commons of the United Kingdom, elected by the first past the post voting system.
Vacancy.
Alexander Murray had been Liberal MP for Midlothian a.k.a. Edinburghshire, since 1900. He was raised to the peerage as Baron Murray of Elibank, in the County of Selkirk.
Previous result.
! scope="col" colspan="2" style="width: 130px"|Party
! scope="col" style="width: 17em"|Candidate
! scope="col" style="width: 5em"|Votes
! scope="col" style="width: 3.5em"|%
! scope="col" style="width: 3.5em"| ;templatestyles src="Template:Tooltip/styles.css" / ;±%
! colspan="3" style="text-align: right; margin-right: 0.5em" | Majority
! colspan="3" style="text-align: right; margin-right: 0.5em" scope=row | Turnout
! style="text-align:right;" | Swing
Candidates.
The Liberal candidate chosen to defend the seat was Alexander Shaw. He was a 29-year-old Barrister who had been educated in Edinburgh.
The Unionists again selected John Hope, a soldier, who had fought the seat at the last general election. 
The Labour Party, which had never contested the seat before, chose Robert Brown. He was a local man, having been elected Provost of Dalkeith. He was also Secretary of the Scottish Miners Federation.
When the seat became vacant, the Unionists quickly reselected Hope to enable them to immediately start the campaign. Arthur Henderson, the National Secretary of the Labour Party, met the Scottish Miners Federation; where it was agreed that a Labour candidate would contest the seat. It was clear that this was likely to be Brown. 
The Liberals were expected to adopt Shaw, however, the outgoing Liberal MP, the Master of Elibank, felt that the Liberal Association should not field a candidate but support Brown, who had strong Liberal sympathies, if he was the Labour candidate. Elibank's telegram to the Chairman of Midlothian Liberals, in which he outlined his views and praised the qualities of Brown, was made public. Elibank had just stepped down as Liberal Party Chief Whip, so was still close to Liberal Prime Minister, H. H. Asquith. However, the Midlothian Liberals decided to select Shaw and Brown was selected by Labour, so a three-way contest was assured.
Campaign.
The seat had returned Liberals at every election since 1874, however, with a Labour candidate in the running; the election was expected to be less than straightforward. 
Brown's Labour campaign joined with the Unionists in criticising David Lloyd George's National Insurance Act. Despite his past Liberal sympathies, Brown was to be found campaigning for the nationalisation of land and the nationalisation of mines. The Labour party campaign received the active support of the Scottish Federation of Women's Suffrage Societies.
The Liberal Party campaign received the backing of T.P.O'Connor and the United Irish League who urged the 600-700 Irish miners in the constituency to vote Liberal, due to the work the Liberal Government was doing on the Irish Home Rule Bill.
Result.
The Unionist Party narrowly gained the seat from the Liberal Party.
! scope="col" colspan="2" style="width: 130px"|Party
! scope="col" style="width: 17em"|Candidate
! scope="col" style="width: 5em"|Votes
! scope="col" style="width: 3.5em"|%
! scope="col" style="width: 3.5em"| ;templatestyles src="Template:Tooltip/styles.css" / ;±%
! colspan="3" style="text-align: right; margin-right: 0.5em" | Majority
! colspan="3" style="text-align: right; margin-right: 0.5em" scope=row | Turnout
! style="text-align:right;" | Swing
Aftermath.
A General Election was due to take place by the end of 1915. By the summer of 1914, the following candidates had been adopted to contest that election. Due to the outbreak of war, the election never took place.
Electorate 19,747
! scope="col" colspan="2" style="width: 130px"|Party
! scope="col" style="width: 17em"|Candidate
! scope="col" style="width: 5em"|Votes
! scope="col" style="width: 3.5em"|%
! scope="col" style="width: 3.5em"| ;templatestyles src="Template:Tooltip/styles.css" / ;±%
Shaw was elected unopposed as the Member of Parliament (MP) for the Kilmarnock Burghs at a by-election in 1915,
In 1918 when the constituency was split, Hope was elected as Unionist member for Midlothian North and Peebles.
References.
 ;templatestyles src="Reflist/styles.css" / ;