from selenium import webdriver
driver = webdriver.Chrome()
driver.get("http://8.8.8.8/")
for i in range(100):
js="window.open('http://1.1.1.%s')" % str(i)
driver.execute_script(js)
#driver.quit()
二、簡單使用2
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
driver = webdriver.Chrome()
driver.get("http://www.python.org")
assert "Python" in driver.title
elem = driver.find_element_by_name("q")
elem.clear() #清空自動填入的值,保證咱們的輸入
elem.send_keys("pycon")
elem.send_keys(Keys.RETURN)
assert "No results found." not in driver.page_source
driver.close() #退出