select = driver.find_element_by_id("id_num")
options_list = select.find_elements_by_tag_name("option")
time.sleep(2)
count_option = 0
for option in options_list:
value = option.get_attribute("value")
text = option.text
filename = text.encode("utf-8")+".txt"
f = open(unicode("D:\\temp\\123_loop\\" + filename, "utf-8"), "w+")
# print "Value is: " + value
# print "Text is:" + text
# print "count_option" + str(count_option)
driver.find_element_by_id("id_num").find_elements_by_tag_name("option")[count_option].click()
count_option += 1
time.sleep(4)
select2 = driver.find_element_by_id("id_num2")
options_list2 = select2.find_elements_by_tag_name("option")
count = 0
for option2 in options_list2:
value2 = option2.get_attribute("value")
text2 = [option2.text+'\n']
# print "Value2 is: " + value2
# print "Text2 is:" + text2
driver.find_element_by_id("id_num2").find_elements_by_tag_name("option")[count].click()
time.sleep(3)
f.writelines(text2[0].encode("utf-8"))
count += 1
f.writelines('\n数据总数:'+str(count))
f.close()
options_list = select.find_elements_by_tag_name("option")
time.sleep(2)
count_option = 0
for option in options_list:
value = option.get_attribute("value")
text = option.text
filename = text.encode("utf-8")+".txt"
f = open(unicode("D:\\temp\\123_loop\\" + filename, "utf-8"), "w+")
# print "Value is: " + value
# print "Text is:" + text
# print "count_option" + str(count_option)
driver.find_element_by_id("id_num").find_elements_by_tag_name("option")[count_option].click()
count_option += 1
time.sleep(4)
select2 = driver.find_element_by_id("id_num2")
options_list2 = select2.find_elements_by_tag_name("option")
count = 0
for option2 in options_list2:
value2 = option2.get_attribute("value")
text2 = [option2.text+'\n']
# print "Value2 is: " + value2
# print "Text2 is:" + text2
driver.find_element_by_id("id_num2").find_elements_by_tag_name("option")[count].click()
time.sleep(3)
f.writelines(text2[0].encode("utf-8"))
count += 1
f.writelines('\n数据总数:'+str(count))
f.close()