If there are two frame, jump into one later operation to complete the second, this situation must first jump, and then jump into another frame
Jump statement: Browser.switch_to_default_content ()
#Coding:utf-8 fromSeleniumImportWebdriverImportTimeurl='http://*******'Browser=Webdriver. Chrome () browser.get (URL) browser.maximize_window () name=browser.find_element_by_name ('username') Name.send_keys ('***') passwd=browser.find_element_by_name ('Password') Passwd.send_keys ('****!') Browser.find_element_by_xpath ('//input[@type = "Submit"]'). Click () time.sleep (5)
A=browser.find_element_by_xpath ("//frameset[@id = ' btframe ']/frame") #找到第一个framebrowser. Switch_to_frame (a)
Browser.find_element_by_link_text (U'Platform Management'). Click () browser.find_element_by_link_text (U'Store Management'). Click () browser.find_element_by_link_text (U'new Shop'). Click () browser.switch_to_default_content () #跳出第一个frameb=browser.find_element_by_xpath ('//frameset[1]/frame[@name = "main"]') #找到第二个framebrowser.switch_to_frame (b) #跳进第二个frame Browser.find_element_by_xp Ath ("//select[@name = ' machine_id ']/option[2]"). Click () Browser.find_element_by_xpath ("//select[@name = ' industry ']/option[3]"). Click ()Print 'OK'