When you have a huge label with thousands of messages, Gmail can't handle deleting all of them at a time (it says it can, but for me it's never worked). This solves the problem.
I wrote it more as a practice to get familiar with FireWatir, so it's not very pretty or anything and it's a bit slow. If you have doubts on how to use or suggestions on how to improve it please feel free to contact me.
By the way, it assumes Gmail is in German. Replace that string with the one that comes up for your language.
1
2 def empty_label(label)
3
4 ff = Firefox.new
5
6 ff.goto('http://mail.google.com/mail/h/x4odcwnm5f5v/?s=l&l=#{label}')
7 a = []
8
9
10 ff.checkboxes.each {|c| a << c.value}
11
12 while a.length > 0 do
13 c = []
14 a.each {|v| c << ff.checkbox(:value,v)}
15
16 c.each {|e| e.set}
17
18 ff.select_list(:name,'tact').select('In den Papierkorb verschieben')
19 ff.button(:name,'nvp_tbu_go').click
20 a = []
21 ff.checkboxes.each {|c| a << c.value}
22 end
23 end