- Selenium-WebDriver API
- -- coding:utf-8 --import osfrom selenium import webdriverfrom selenium.webdriver.common.keys import Keyschromedriver = "./chromedriver"driver = webdriver.Chrome(executable_path=chromedriver)print 'start'driver.get(" http://www.baidu.com/")assert u"百度一下" in driver.titleelem = driver.find_element_by_name("wd")elem.send_keys("selenium")elem.send_keys(Keys.RETURN)assert "selenium" in driver.titleprint 'end'#driver.close()
Selenium-WebDriver API
seleniumhq官方文档:
http://docs.seleniumhq.org/docs/03_webdriver.jsp
Selenium Python文档:
http://selenium-python.readthedocs.io/getting-started.html
Selenium简单的用法示例
-- coding:utf-8 --import osfrom selenium import webdriverfrom selenium.webdriver.common.keys import Keyschromedriver = "./chromedriver"driver = webdriver.Chrome(executable_path=chromedriver)print 'start'driver.get("http://www.baidu.com/")assert u"百度一下" in driver.titleelem = driver.find_element_by_name("wd")elem.send_keys("selenium")elem.send_keys(Keys.RETURN)assert "selenium" in driver.titleprint 'end'#driver.close()
当前内容版权归 piaosanlang 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 piaosanlang .