#coding=utf-8
from selenium import webdriver
import time
driver = webdriver.Chrome()
driver.get("http://www.baidu.com/")
driver.get("https:/www.hao123.com")
s = driver.find_elements("css selector", "word-item")
print(s)
elements = driver.find_elements_by_class_name("word-item")
print(elements)
elements[1].click()
elements[2].click()
elements[3].click()
#获得当前窗口
nowhandle=driver.current_window_handle
#打开注册新窗口
#driver.find_element_by_name("tj_reg").click()
#获得所有窗口
allhandles=driver.window_handles
#循环判断窗口是否为当前窗口
for handle in allhandles:
driver.switch_to_window(handle)
js="var q=document.documentElement.scrollTop=10000"
driver.execute_script(js)
time.sleep(6)
#回到原先的窗口
#driver.switch_to_window(nowhandle)
time.sleep(3)
print("ooooooooooooooooover")
#driver.quit()