1. Browser Operation
driver.maximize_window() #Maximize the window
driver.execute_script('window.scrollTo(0,0);') #Scroll the window to the top
driver.get_screenshot_as_file('jietu.png') #Intercept the current page
2. Get the label element
#Locate the target element by id
driver.find_element_by_id('i1').send_keys('Moon out of Tianshan') #Locate the
target element by classname
driver.find_element_by_class_name('classname').send_keys('Boundless Clouds') #By
name attribute Locate the target element
driver.find_element_by_name(name='name').send_keys('Changfeng tens of thousands of miles')
# Locate the target element through Xpath
driver.find_element_by_xpath('//*[@id="i1"]').send_keys ('Buidu Yumenguan')
# Locate the target element by css selector
driver.find_element_by_css_selector('.classname').send_keys('Hanxia Baidengdao') #Locate
by label name (in a page, the label will be repeated, so no need This is used to locate)
driver.find_element_by_tag_name('input')
# Find element by text in tag
driver.find_element_by_link_text('login') # Find driver
by fuzzy matching of text in tag .find_element_by_partial_link_text('登录')
3. Shutdown and Exit
driver.close() #When more than one is opened, close the current page
driver.quit() #Exit and close all pages