너무 궁금해서 올립니다.
글쓴이: bedals / 작성시간: 토, 2019/05/11 - 1:37오전
for page_num in range(0,5): body = driver.find_element_by_xpath('/html/body') while num_of_pagedowns: body.send_keys(Keys.PAGE_DOWN) time.sleep(0.5) num_of_pagedowns -= 1 html = driver.page_source soup = BeautifulSoup(html,'lxml') ul = soup.find_all('ul', class_="_2klRMnwJXJ") titles =soup.find_all('li', class_="_1SzfBYA4Wc") for title in titles: item_name = title.find('span',class_='_2rxlO_K3YY').get_text().strip() print(item_name) keyword = title.get('id') rank += 1 if item_name == '라세아': print(str(rank)+"번째 : "+" {} : {} ".format(item_name,keyword)) driver.find_element_by_xpath('//*[@id="%s"]/a/div/div[2]/span[1]/span/span[text()="라세아"]'%(keyword)).click() driver.quit() else: elem = driver.find_element_by_xpath('//*[@id="content"]/div[5]/a[%d]'%(page_num+1)).click()
가정은 10개의 웹페이지에서 제가 원하는 라세아라는 항목을 찾아서 클릭하는건데요
마지막 elem 클릭 후 다시 body = driver.find_element_by_xpath('/html/body') 이문장부터 시작해서
크롤링하는 걸 만들고 싶은데 방법이없을까요?
Forums:
저도 너무 궁금해서 댓글 다는데, 조회수 올리기
저도 너무 궁금해서 댓글 다는데, 조회수 올리기 위함인가요?
댓글 달기