Learning Python automation - control of the browser

Selenium the webdriver Import from 
Import Time 
Driver = webdriver.Chrome () 
driver.get ( "https://www.baidu.com/") 

# control the browser 
# control of the browser window size 
# by set_window_size () method sets the browser window size 
print ( "wide 400 set your browser to display high 800") 
driver.set_window_size (400, 800) 
the time.sleep (2) 

# set the browser window to full screen 
driver.maximize_window () 
the time.sleep (2) 

# into the news pages in 
driver.find_element_by_link_text ( "News") .click () 

# returns to the previous page 
driver.back () 
the time.sleep (2) 

# Forward News pages 
driver.forward () 
the time.sleep (2) 

# refresh the current page 
driver .Refresh () 
the time.sleep (2) 

driver.quit ()

  

Guess you like

Origin www.cnblogs.com/LT-XILI/p/11619577.html