#coding =utf-8from Selenium Import webdriver #引入selnium模块的webdriver包 #import time #引入time函数 #browser=webdriver. Firefox () #初始化打开Firefox浏览器 #browser.get (") #打开百度网站 # Time.sleep (0.3) #休眠0.3 sec. #browser.find_element_by_id (" kw "). Send_ Keys ("Selenium") #找到百度输入框的ID: KW, then enter the value Selenium search #time.sleep (2) #休眠2秒 #browser.find_element_by_id ("su"). Click () # Click the Baidu search box ID is su, by clicking () #time. Sleep (3) # Sleep 3 seconds #browser.quit () #退出浏览器 #selenium is a tool for Web automation testing, supporting C,c++,python, Java and other languages, he is able to simulate the manual operation of the browser, automated testing.
This article is from the "Cheng Technology blog" blog, make sure to keep this source http://zhengshuheng.blog.51cto.com/1439780/1571881
Python Selenium+webdriver Automation Test Example