21.03.10 12:45 작성
·
200
0
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import time
chromedriver= ('C:/Users/admin/dev_python/Webdriver/chromedriver.exe')
driver=webdriver.Chrome(chromedriver)
driver.get("http://www.python.org")
print(driver.title)
print(driver.current_url)
assert "Python" in driver.title
search = driver.find_elememt_by_id("id-search-field") #id인 태그를 찾아서 키보드로 입력값을 넣어준것임
search.clear()
search.send_keys("python")
search.send_Keys(Keys.RETURN)
time.sleep(2)
assert "No result found." not in driver.page_source
data=driver.find_elements_by_css_selector("#content > div > section > form > ul > li > h3 > a")
for item in data:
print(item.text)
driver.quit()
여기결과가 아래와 같이 뜹니다. 올바로 작성한것같은데 어느부분이 문제인지요? ㅜㅜ