基于 SELENIUM 的自动化测试架构(12)
发表于:2017-04-11来源:gitbook作者:凌俣Linty?点击数:
标签:selenium
# 声明一个司机,司机是个Firefox类的对象 driver = webdriver.Firefox() # 让司机加载一个网页 driver.get( http://demo.ranzhi.org ) # 给司机3秒钟去打开 sleep( 3 ) # 开始登录
driver = webdriver.Firefox()
driver.get(
"http://demo.ranzhi.org")
sleep(
3)
we_account = driver.find_element_by_css_selector(
'#account')
we_account.clear()
we_account.send_keys(
"demo")
we_password = driver.find_element_by_css_selector(
'#password')
we_password.clear()
we_password.send_keys(
"demo")
driver.find_element_by_css_selector(
'#submit').click()
sleep(
3)
常用的重点编程对象有如下几种:
WebDriver 类